No, you're right that binding does not use weak listeners (we tried at the end of Flex 2 development and found some really bad bugs if we did that). So I shouldn't be making a global statement about don't check bindings. But I guess my point is not that not all bindings are bad, especially when done within a single MXML document that doesn't try to reach outside. Best practice is to be wary of how easily you reach out into other parts of the app. The more you can centralize that kind of thing, the easier it is to have code that releases listeners, references, etc.
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Samuel R. Neff Sent: Wednesday, January 23, 2008 9:25 AM To: [email protected] Subject: RE: [flexcoders] destructing objects / memory management best practices Matt, My understanding from reading the binding code is that bindings do not use a weak reference when they add an event listener, so bindings must be cleared (unwatched) in order for an object to be available for GC? Are bindings created through MXML automatically unwatched at any point? Or am I wrong about bindings using a strong reference? Thanks, Sam ------------------------------------------- We're Hiring! Seeking a passionate developer to join our team building Flex based products. Position is in the Washington D.C. metro area. If interested contact [EMAIL PROTECTED] ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Matt Chotin Sent: Wednesday, January 23, 2008 11:34 AM To: [email protected] Subject: RE: [flexcoders] destructing objects / memory management best practices I'm not sure that binding is the first thing to look at. Have you made sure that relevant event listeners are adding themselves with the weakRef param set to true? Sometimes in addition to removing children you may also want to try setting some references explicitly to null as that can help accelerate garbage collection. Finally, using the debug player make sure to run the GC manually just to ensure that it isn't simply a delay in recollection. There is a known issue where event listeners that are still around and should technically be GC'd might still receive event listener messages until they have been reclaimed. Matt

