It would be pretty hard for that line to cause a leak.  It is more
likely to be whatever updateTime is doing.

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of steve.baney
Sent: Friday, July 25, 2008 8:18 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Timer memory leak

 

Howdy all!

I've got a memory leak issue with my problem. I just added a third
party countdown timer component to my project. I've narrowed down the
culprit to the event listener that listens for the timer event and
then calls an updateTime function.

timer.addEventListener("timer", updateTime, false, 0, true);

As you can see, it uses a weak reference, as it should.

The updateTime function declares two event objects, and checks if the
timer has reached zero. It either stops the timer and throws a
completed event, or it throws an event to update the visual component
to the new time.

Removing the addEventListener function plugs the leak, but the visual
component never gets updated. I've moved the declarations of the two
events from within the updateTime to the class itself to stop the
timer from creating new objects every time it fires, but the app still
leaks.

It seems that everything is technically correct, but calling a
function evey second is just devouring memory. So I guess I'm looking
for a workaround to update the display without an event
listener....yeah that may be impossible...

Any suggestions?

 

Reply via email to