Download

What happens to objects like a savegame object when they are loaded but not saved in any variable?

Are they automatically destroyed or do they persist in memory?

If the object is not saved to a variable it’s destroyed eventually. If it’s assigned to a variable within an actor that’s placed/spawned it will persist.

Thank you, I was afraid that I was spawning objects that would pile up until I run out of memory

To go further on the subject if you wanted to learn more, this process is called Garbage Collection. (UE4 Doc: here) Garbage Collectors are a common part of most programming languages, its job being to remove objects from memory when they are no longer referenced by any variable. So as long as you aren’t saving all of your objects into variables, you can be relatively confident that you aren’t loading up memory will a bunch of cruft.

In most programming languages, Local Variables you use in a function(and also the Parameters) are created when the Function is called and deleted immediately when the function ends.
See Call Stack

I don’t know how UE handles Events. Basically they are functions without a return type, but since they allow latent functions I dunno how the memory management is set up.