Could you be registering anonymous functions as event listeners and other 
callbacks?


On 8/30/10 12:52 PM, "lew.miller" <lew.mil...@gmail.com> wrote:






Thanks Alex.  I don't have any simple test case indicating that they leak, I'm 
just struggling to understand what is causing certain leaks in a large 
application where the profiler points me to activation objects.

So when tracking memory leaks with the FB4 profiler you're saying one 
can/should simply ignore any object reference paths that start with activation 
objects?  (If so, it would be nice if they weren't reported--but that's a 
separate issue.)  Can you tell me what it means when the profiler lists 
activation objects?  Does that imply some corresponding function is executing 
at the time the memory snapshot was taken?  If I understood why I'm getting all 
these references from activation objects I'd feel a bit more comfortable about 
ignoring them. :-)

My application makes use of anonymous functions in places and I read an old 
Adobe Developer Connection article that says:

"Defining functions on the fly causes an arcane memory leak in Flash Player 
because the activation object sent to the function can never be recovered by 
the garbage collector. So the bottom line is to avoid dynamic classes and 
explicitly define all the properties and functions used in your classes."

It doesn't elaborate and was written in 2006 so it may be irrelevant but makes 
me wonder.

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> , Alex 
Harui <aha...@...> wrote:
>
> AFAIK, they do not cause leaks.  If you show some data or a simple test case 
> that indicates that they are, I will try to take a look.
>
>
> On 8/30/10 8:36 AM, "lew.miller" <lew.mil...@...> wrote:
>
>
>
>
>
>
> I've been wrestling with memory leaks and the FB4 profiler and lately have 
> been trying to understand activation-objects and their relationship to GC 
> because the vast majority (often all) of the references the profiler tells me 
> an object has keeping it in memory come from activation objects.
>
> While researching this I came across a note from Alex Harui saying "I've 
> never seen an activation object cause a leak" but other things I've read seem 
> to suggest they can.  (Certainly the profiler would lead me to believe it.)  
> Can anybody enlighten me?  Or just point me to the place to read 
> documentation on the subject that is up-to-date?  Half of what I've read 
> about activation objects appears to be from earlier versions of ActionScript 
> so I'm not sure what to believe.
>
> If an activation object can cause a memory leak, I'd like to understand how.  
> I may not have a firm grasp of the lifecycle of an activation object but I 
> thought it would no longer be accessible from the GC root after the function 
> it's created for finishes executing.
>
> Any help or pointers would be greatly appreciated.
>
> Lew
>
>
>
>
>
>
> --
> Alex Harui
> Flex SDK Team
> Adobe System, Inc.
> http://blogs.adobe.com/aharui
>






--
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui

Reply via email to