Adobe Dreamweaver Forums



Last 10 THreads :         PLACING NEW LAYER BELOW THE ORIGINAL (Last Post : Lenore_Abboud@adobeforums.com - Replies : 2 - Views : 3 )           »          Strip EXIF camera data from PSD files? (Last Post : Ho - Replies : 1 - Views : 2 )           »          Is Adobe really turning its back on me? (Last Post : dave_milbut@adobeforums.com - Replies : 8 - Views : 9 )           »          Objects "Framed" when moving layer (Last Post : Ann_Shelbourne@adobeforums.com - Replies : 1 - Views : 2 )           »          How does this configurator module work? (Last Post : Marvinzzz - Replies : 0 - Views : 1 )           »          Apache Connector failures on RHEL5 (Last Post : macbookrocco - Replies : 0 - Views : 1 )           »          Canvas ID that generate by Repeater (Last Post : Wirawannaga - Replies : 0 - Views : 1 )           »          Re: Image Sequences in Flash? (Last Post : Rothrock - Replies : 0 - Views : 1 )           »          Query question/help (Last Post : Dan Bracuk - Replies : 1 - Views : 2 )           »          cfapplication in Application.cfc (Last Post : Dan Bracuk - Replies : 8 - Views : 9 )           »         


User Info Statistics
Go Back   Adobe Dreamweaver Forums > Macromedia Software > Flex
 
Tags:



Reply
  #1 (permalink)  
Old 11-03-2008, 04:38 AM
bill.cabral
 
Posts: n/a
Diggs:
Default eventListeners, bindingUtils, garbageCollection andyou...

Hey everyone,

I hope somewhere can help me with this, because I have been running in circles
on this. I am developing on a fairly large application and have recently
noticed that instances of my class that have event listeners of data binding
tied to them cannot be garbage collected. It has led to some fantastically
bizarre artifacts and some gross memory leaks. Multiple copies of screens
modifying and accessing the same array collections and such...fun. The way I
see it, there are three real solutions here...

1.) dictate that all programmers declare weak references when creating event
listeners
2.) create some sort of onDestroy method that kills bindings and removes
eventlisteners when a child is removed from it's parent
3.) override the addEventListener method to ensure that weak references are
made, when people inevitable forget #1!

My questions are thrice: are those my only options?! Or have any of you more
experienced folks conquered this situation in a more elegant, reliable way? If
these are my only options, which is the best, in your opinions?

Thank you very much for any info you can give; I'm relatively new to Flex and
while I understand the GC's terms and conditions, I'm hoping there is some way
to avoid a massive rewrite/refactoring to make it work with me. Thanks again!

-=Bill



Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-03-2008, 04:38 AM
Amy Blankenship
 
Posts: n/a
Diggs:
Default Re: eventListeners, bindingUtils, garbageCollection and you...


"bill.cabral" <webforumsuser@macromedia.com> wrote in message
news:gdqvng$cav$1@forums.macromedia.com...
> Hey everyone,
>
> I hope somewhere can help me with this, because I have been running in
> circles
> on this. I am developing on a fairly large application and have recently
> noticed that instances of my class that have event listeners of data
> binding
> tied to them cannot be garbage collected. It has led to some
> fantastically
> bizarre artifacts and some gross memory leaks. Multiple copies of screens
> modifying and accessing the same array collections and such...fun. The
> way I
> see it, there are three real solutions here...
>
> 1.) dictate that all programmers declare weak references when creating
> event
> listeners
> 2.) create some sort of onDestroy method that kills bindings and removes
> eventlisteners when a child is removed from it's parent
> 3.) override the addEventListener method to ensure that weak references
> are
> made, when people inevitable forget #1!
>
> My questions are thrice: are those my only options?! Or have any of you
> more
> experienced folks conquered this situation in a more elegant, reliable
> way? If
> these are my only options, which is the best, in your opinions?
>
> Thank you very much for any info you can give; I'm relatively new to Flex
> and
> while I understand the GC's terms and conditions, I'm hoping there is some
> way
> to avoid a massive rewrite/refactoring to make it work with me. Thanks
> again!



There aren't any easy answers, but this might point you in the right
direction:
http://link.brightcove.com/services/...tid=1741212660

Keep in mind that any event listeners added within the scope of a component
will be destroyed when the component is destroyed.

so this.addEventListener=OK
that.addEventListener=may not be

HTH;

Amy


Reply With Quote
  #3 (permalink)  
Old 11-03-2008, 04:38 AM
bill.cabral
 
Posts: n/a
Diggs:
Default Re: eventListeners, bindingUtils, garbageCollection andyou...

Thank you very much, I'll check it out. I appreciate the assistance!
Reply With Quote


  #4 (permalink)  
Old 11-03-2008, 04:38 AM
Amy Blankenship
 
Posts: n/a
Diggs:
Default Re: eventListeners, bindingUtils, garbageCollection and you...


"bill.cabral" <webforumsuser@macromedia.com> wrote in message
news:gdsovt$re0$1@forums.macromedia.com...
> Thank you very much, I'll check it out. I appreciate the assistance!


You're welcome :-)


Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 02:46 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Inactive Reminders By Mished.co.uk