I use this
timer.performWithDelay(1, function() collectgarbage("collect") end)
to garbage collect at the beginning of my title screen. I then display
collectgarbage("count")
on the screen to show how much memory the game is using at that point.
In the simulator, I can have the game play itself for awhile and then return to the title screen. The memory is always a bit different depending upon how far it got playing itself, but it’s always just a bit up or down within a reasonable range.
But when I run on the iPad, it will play the first time through at normal speed, then each subsequent run gets a bit slower and slower. After four or so runs it’s in slow motion. The memory display is the same as the simulator, just a bit up or down each run but always within a reasonable range. Therefore, I know I don’t have a memory leak problem (if I had a memory leak, the number would always go up and never come back down).
So what in the heck else could be causing that? I do have three
Runtime:addEventListener("enterFrame", xxxxx)
listeners that run during the course of each run (one at a time… never two or three at once), but I also shut each of them down
Runtime:removeEventListener("enterFrame", xxxxx)
Are forgotten and always running listeners and memory leaks the only two things that could cause a game to slow down over time?
Any suggestions welcome!
Thanks…
[import]uid: 5540 topic_id: 25059 reply_id: 325059[/import]