Hi,
I’ve read some posts about people having troubles with memory leak with persistent objects, some with solutions, some without them. So i got a little confused what situations can cause them to have memory leak.
So in my case, I’m planing to use a persistent singleton object to manage popups, create it’s own camera, with objects attached to it with the textures and persist this object through all the scenes, but initialize it only once in a “initial scene” which will never be called again. Does this may leave memory leak or any issue?
I have a second option, which would be a non persistent object, which it will start and destroy in every scene, but it makes me feel like the loading time will be increased doing it, since the object must be created and destroyed everytime and textures will be loaded again every scene.
So may i follow the first option without any worries or should I follow another option?
Thanks in advance.
1 Like
I do have a problem with a memory leak that seems to happen in standalone builds only. This causes the game to misbehave and it’s quite annoying. The output log file indicates at the very bottom that there is a memory leak somewhere and I would assume that it’s related to the loading of a scene at runtime, since it’s the only thing that shows a negative number.
Here is the very last line of my game’s output_log file:
##utp:{“type”:“MemoryLeaks”,“allocatedMemory”:11072,“memoryLabels”:[{“Default”:1048},{“NewDelete”:376},{“Thread”:8},{“Manager”:112},{“VertexData”:2544},{“GfxDevice”:1808},{“FMOD”:640},{“Serialization”:40},{“String”:1224},{“DynamicArray”:2960},{“VR”:64},{“SceneManager”:480},{“SceneLoad”:-240},{“Secure”:8}]}
you should really connect he profiler to your player, and see how memory behaves during gameplay.
Info printed after player exits, is not very useful to you, because garbage collector basically frees everything game related.
Regarding that minus value, that’s basically an error in the engine, where allocation was made with one label, but freed with other, it’s not serious, just gives bad information.