Thank you, ninjapig123! I really appreciate your help.
So… unless I cancel & nil the timer, it will not get cancelled/nilled nor will it ever garbage collected? The thing is, I use the cancelAllTimers() function that Jonathan Beebe has posted (one of many great functions he has offered for everyone). You can find it here (scroll down to Timers and Transitions section):
http://blog.anscamobile.com/2011/08/corona-sdk-memory-leak-prevention-101/
And this cancelAllTimers() looks like it would cancel and nil out all timers, and I thought it was all I needed to do, until I read an alert that says:
The cancelAllTimers() function should only be used as a cleanup! Please run :cancel() and nil out timers individually before calling cancelAllTimers(), so keep track of them all!
The alert is located here: http://developer.anscamobile.com/code/beebegames-class
I’m not sure what it’s really saying. But I thought, maybe, I can do something like the following to cancel and nil out timers that are piling up on timerStash. Would something like this work?
local function cancelMyTimers()
for numLoop=#timerStash,1,-1 do
timer.cancel(timerStash[numLoop])
timerStash[numLoop] = nil
end
end
But then, why on earth do I even need to call cancelMyTimers() before calling cancelAllTimers()? What am I missing? I just don’t understand the logic behind the need for what-appears-to-be double cleanup.
I’m probably not seeing something that’s obvious to experts… Maybe the cancelMyTimers() just doesn’t cut it either.
If you can shed light on this, I’d be so grateful.
[import]uid: 67217 topic_id: 14454 reply_id: 53496[/import]