Non-UObject pointers in a UObject class

I have been reading up on how the garbage collector works in UE4 and I just wanted to clarify a few things.

Since non-UObject pointers cannot be decorated with UPROPERTY, I’m guessing memory management for these kinds of objects will just be handled by the programmer with new and delete. Is this the case?

I read in another question that TSharedPtr/TSharedRef/TWeakPtr classes are supposed to be used for non-UObjects. Does this mean that one should just never use a plain pointer in a UObject class? Thanks!

Dear Tginick,

You are entirely responsible for memory management of data that is below the UObject subsystem level!

I use plain pointers all the time. My entire custom HUD animation system is pure C++ and plain pointers and new and delete all over the place, you can see the results in these videos!

If you are going to do your own memory management I suggest checking out my wiki tutorial on the subject

#Dynamic Memory Management in UE4

Awesome answer. Thank you! :slight_smile: