Hi Olav,
In my experience, printing out memory usage can be a bit misleading. Just doing a garbage collection doesn’t necessarily show an instant result… sometimes it takes several frame cycles to reflect the new value.
What I do, in testing memory, is to run a 1-second repeating timer of my memory printout, then I run my game and play each “stage” of it… open up the menu, load scenes, exit scenes, return to menu, restart the level, etc. While doing that, I look for “patterns” in the memory readout… typically there will be a value that you’ll begin to recognize. For example, when I go through 10-15 cycles of “load-exit-load-exit” or “restart-restart-restart”, one number will surface as a “common” value no matter how many times I repeat the cycle. When that happens, I’m quite convinced that I’m cleaning up everything properly… because the number is -exactly- the same over a dozen iterations of the gameplay.
Now, if the value kept gradually creeping up in value, then I’d suspect my memory was leaking somehow.
Brent [import]uid: 200026 topic_id: 34463 reply_id: 139341[/import]