Are there guarantees for the garbage collector?
Like, that an object doesn’t get destroyed by the garbage collector in the same frame, as it was created?
Are there guarantees for the garbage collector?
Like, that an object doesn’t get destroyed by the garbage collector in the same frame, as it was created?
Hello,
To ensure that the object will be properly handled in terms of Garbage Collection (in other words, it won’t get deleted while still being referenced in your code), please make sure that the following conditions are met:
You use UObject and UObject-derived objects (in other case, please use Smart Pointers);
Your class members are declared as UPROPERTY;
Please also note that the only type-safe container is TArray.
If you like to learn more about Garbage Collection in Unreal Engine 4, please go here:
Hope this helped!
Cheers!
Can I assume, that the object won’t be deleted by the GC during the same frame as it was created? Event if it’s not referenced by a UProperty?