They are not weak, because they don't have to be.  When you say:
 
<mx:Button id="button" click="doSomething" />
 
The MXML compiler wraps doSomething in a function like this in the
application:
 
public function __Button__click(event:Event):void
{
    doSomething();
}
 
and the Flex framework code calls
 
button.addEventListener("click", __Button__click);
 
This puts a reference to the application's __Button__click method in the
button's event handler table.  There are no additional pointers to the
button from the application so it does not prevent collection should you
remove the button. 
 
I have a presentation on garbage collection and memory on my blog
http://blogs.adobe.com/aharui/2007/03/garbage_collection_and_memory.html
You can use -keep-generated to view the generated code from MXMLC.
 
-Alex

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of geoffreymina
Sent: Saturday, April 14, 2007 8:14 AM
To: [email protected]
Subject: [flexcoders] Inline MXML event handlers - weak reference?



Does anyone know if the event handlers you inject into MXML components 
are weak references? There is no way to remove the event handler, so I 
don't see how they couldn't be... but I am struggling with lots of 
memory leak issues right now and this could be the source.

Thanks,
Geoff



 

Reply via email to