Removing UPROPERTY TArray with content causes memory leak

XynanXDB
Fri, 07 May 2021 15:36:56 +0000
Editor Scripting

Hi, I have discovered a bug where if you remove an UPROPERTY TArray with content in C++ without manually clearing the content in editor will cause memory leak where the content of TArray will stay referenced by owner.

Steps to reproduce:

1. Make a UPROPERTY(EditDefaultsOnly) TArray>

2. Go into editor and fill up the array with actor BPs

3. Go back to source code editor and remove the TArray

4. Go back to owner of the removed TArray and use reference viewer

5. Reference viewer will show the owner of the removed TArray referencing the content of the TArray even though the TArray is removed in C++. Hence, memory leak.

Expected outcome:
After the removal of the TArray, the owner of TArray should clear all the referencs to the content of TArray.

2 posts - 1 participant