Struct destroy and garbage collection

The engine does not garbage collect anything other than UObjects. If you create structs (or indeed, any data type) with new, you are responsible for deleting them. Even if you allocate a struct within a UObject, you must delete that data before the UObject is destroyed - the engine can’t and won’t do that for you.

Where appropriate, you can and normally should use Smart Pointers to make this simpler.

1 Like