I found some code somewhere and I’m using it to try and track memory leaks.
My game fires up listeners at the beginning and are not re-called. I think I’m cleaning up, so I’m trying to understand the values returned.
collectgarbage("collect")
local systemMemory = collectgarbage("count")
print("\*\*MEMORY\*\* At Start of Game - System Memory " .. systemMemory .. " Texture Memory: " .. system.getInfo("textureMemoryUsed") .. " level " .. level)
I call it at the beginning of the game and at the beginning of each time I die.
The good news is that the Texture Memory seems to be the same every round. It starts higher at the beginning of the game (or when the game is over) but drops when it gets to the Start Round function.
What I’m having trouble with is the collectgarbage(count) return value. First what is that measured in? I’m getting values like 248.2919921875. Is that in megabytes? I can’t believe my game is 248M. The Texture memory is reporting in the 18-19mb range (19,034,112). My total compressed app is around 10mb. My audio is around 5mb at most.
Is my collectgarbage(count) way out of line? This is a reasonably small space shooter.
Oh it starts at 243.xxxx and after a few runs its up to 261.xxxx. Since my texture memory isn’t going up. I’m keeping all my sounds around since I use them over and over. I’m not calling my addListener’s more than once. So about all I can think of thats left are timers and tweens and I think I’m doing a good job of cleaning them up.
Rob [import]uid: 19626 topic_id: 9178 reply_id: 309178[/import]