Sep 15, 2008
I'm writing a video game and I have used timers all over the place to make everything go. Now I want to be able to pause the game, completely. Meaning, I need to stop and start all timer instances at once, or globally. So I created a Timer subclass called CustomTimer, put some statics in there, came up with the attached code. Now my problem is that I'm pretty sure I've created a memory leak, in that the instances array will just grow and wont allow or gc. So, my question is, is there an "onDestroy()" method or somesuch, that I can override, and use that moment to remove instance refs from the instances array? Or, is there a smarter way to do this? an application object with a pause method perhaps?
View 11 Replies