Question about Garbage Collection

So as I understand it , UE4 would only GC variables created as a UProperty … and yet so far(I’m only in Section3) I see you use UProperty mainly to expose variables to the editor, but if what I read about GC is true, shouldn’t all class variables be declared as a UProperty?

Hi there, we are introducing concepts slowly. In Testing Grounds we start using the Profiler to measure performance including memory leaks, so at this stage we’ll consider GC - a topic I have been delaying until the basics are covered.

Thanks for the great question.

1 Like

Generally speaking GC should be used for large data. Since the purpose of Garbage Collection is to free up memory. If the data you use uses small or tiny amount of memory it makes little sense to use either Garbage Collection or pointers or any form of memory management.

Also be aware of the accumulating effect of data, meaning using a ton of tiny data will still consume a ton of memory if that memory is not released on a regular basis.

Memory will be released in any case that the game or application is exited.

More info cam be found here

1 Like

Privacy & Terms