Timer, clean timer , local timer, about timers, Memory Leaks

Hi…
I have memory leaks in my game. I almost checked everything except timers.
I’am using director Class
Please if someone can tell me how I should clean timers.
In code examples I saw :
local TheTimer = timer.performWithDelay…
or
timer.performWithDelay…
Some of this timers are cleaned on the end :

if TheTimer then timer.cancel( TheTimer ); end
if continueTimer then timer.cancel( continueTimer ); end

some are not. I’am so confused… [import]uid: 13156 topic_id: 8579 reply_id: 308579[/import]

are you setting [lua]TheTimer=nil[/lua] after [lua]timer.cancel(TheTimer)[/lua]

are you sure your variables are in the current scope? eg when you do [lua]print(TheTimer)[/lua] before your cancel do you get an actual table address rather than nil?
[import]uid: 6645 topic_id: 8579 reply_id: 30806[/import]

no I’am not setting TheTimer = nil, I know that it’s a good solution but the problem is that I don’t know which timer should I clean.
In one level I have 20 different timer.performWithDelay… should I change it to :
local something = timer.performWithDelay…
and then
timer.cancel(something)
something = nil

I mean that some timers are cleaned and some are not.
Maybe I’am wrong maybe timers don’t make memory leaks. ?
I finished my game , every thing works fine BUT I have memory leaks.
[import]uid: 13156 topic_id: 8579 reply_id: 30837[/import]

why not keep an array of timers ([lua]myTimers[#myTimers]=timer.performWithDelay(…etc…)[/lua] and then clean up the timers from the array if you need to clean everything. individual timers, if they dont clean themselves up: you can use [lua]event.source[/lua] to reference it in it’s completion function, but i would have thought they’d clean themselves up when they complete [import]uid: 6645 topic_id: 8579 reply_id: 30857[/import]