My rule is pretty simple:  Use strong references unless it is impossible
or impractical to know when to remove the listener.

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Josh McDonald
Sent: Monday, July 14, 2008 10:30 PM
To: [email protected]
Subject: Re: [flexcoders] When not to use weak references?

 

Now that I've been corrected on what the weak listeners *actually* do, I
definitely agree on using weak references against long-life objects when
possible =)

-Josh

On Tue, Jul 15, 2008 at 3:17 PM, Tim Rowe <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:

Strong references don't cause memory leaks, bad coding and lack of
understanding of components causes memory leaks.  This seems to be a
topic a lot like pointers all over again 30 years later, WRT how many
people understand them (or don't).

 

I actually agree you'd normally want a strong reference with a timer, if
it's going to continue to live.  Admittedly in that area I'm only
regurgitating what I've told (by many) and understood, as I've not yet
had to implement any timer code (or much in Flex at all) - but this is a
topic I'm keen to try to get right and understand from the start before
I get too deep in to things.  On timers and singletons there's something
going on there that I haven't quite done enough research into, but in
what research I have done I I can't seem to find much that says a strong
reference should be used on these kinds of objects.  Like I said, feel
free to correct me on anything here.

 

Personally I'd be happy to just do away with garbage collection
altogether - that would 'solve' the problem ;)

 

I must admit I'm finding a lot of anti-patterns and bad
implementations/ideas in the Flex world so far.

 

 




-- 
"Therefore, send not to know For whom the bell tolls. It tolls for
thee."

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>  

 

Reply via email to