Force Garbage Collection

Dear Chris,

The title of your thread, in World.h :slight_smile:

#Running When You Want

You could run it on a timer :slight_smile:

//void ForceGarbageCollection( bool bFullPurge = false ); //I use True
GetWorld()->ForceGarbageCollection(true);

#Crashes Solution → IsVallidLowLevel()

For actors that could be garage collected,

you can do this check

if(!Actor->IsValidLowLevel()) return; //dont try to access null or is-being-destroyed
Actor->DoStuff();

I find that catches a lot of what would otherwise be crashes when GC has just been forced

Rama

1 Like