I'm creating several objects in one scene, then switching to another. Is there any way to test how much memory I'm using?
I don't want my game to slow down after playing 20-30 levels.
Is there any way to release objects manually? Any other suggestions/tips?
Disclaimer: I don't know much about Garbage Collection.
People call me "underscore".
Comments
I also collect garbage a few times before this as I've found it helps me see if it's my code that's causing memory build up or just a delay in automatic garbage collection, so I actually use:
Do you do anything special when changing scenes, to make sure that the objects are released? How much memory leak do you normally see when changing scenes with/without manual garbage collection?
Memory use seems to depend on what sort of things are in the scene, but what I watch out for is that it dooesn't keep building up. I sometimes see a small increase for a while but it flattens out and stops increasing and then, as garbage collection does it work, tends to drop back again. When I have a leak, then I see the memory use steadily increase continuously.
Just ran your code on my game. Usage seems pretty stable.
http://pgl.yoyo.org/luai/i/collectgarbage
"count": returns the total memory in use by Lua (in Kbytes).
www.tntengine.com