This is probably a silly question (or maybe not). If I don’t attach a “handle” to a timer (i.e. assign it to a local variable), does it get automatically garbage-collected upon its termination?
For example:
timer.performWithDelay( 1000, restartLevel )
When it triggers after 1000 milliseconds, does the timer go bye-bye forever? Or does it linger around in memory somewhere? I understand how to force cancel a timer, if necessary… I’m just hoping that’s not necessary, and that Corona cleans up timers automatically unless they’re attached to a specific variable handle.
Not a silly question, I wondered this too when I first started using timers. As far as I can tell the memory is freed after the timer is finished. If someone can refute this then I would love to hear it, but I haven’t noticed any memory leaks from my timers.
Corona cleans up timers automatically unless they’re attached to a specific variable handle.
Actually it seems like Corona even cleans up timers when they are attached to a variable handle. The variable tests as nil after the timer runs out, it’s pretty convenient. [import]uid: 12108 topic_id: 6325 reply_id: 21953[/import]