It means the SWF has been garbage-collected.

 

Just because an event listener hasn't been removed doesn't mean that
something can't be GC'd.  Suppose I have the following

 

<mx:Application ......... creationComplete="doSomething()" >

 

When this gets loaded by a SWFLoader, the SWFLoader has a reference to
this Application object.  The Application sets up an event listener for
the creationComplete event by calling

 

this.addEventListener("creationComplete", doSomething_wrapper);

 

This puts a reference to the doSomething method (actually a wrapper)
method in the Application's event table.  When a GC happens, the player
starts searching from the top of the display list.  It finds the
SWFLoader which finds the application which finds the wrapper in the
event table.

 

Once the same SWFLoader loads something else, it is no longer
referencing the Application.  When a GC happens, the player starts
searching from the top and will not find the Application so it will be
GC'd.  The fact that it was pointing to one of its methods from its
event table makes no difference.

 

Now if code in the application added a listener to something higher up
like the stage or something like that, then the stage's event table has
a reference to the application and it won't get GC'd.

 

You can check out my blog presentation for more information
http://blogs.adobe.com/aharui/2007/03/garbage_collection_and_memory.html

 

-Alex

 

________________________________

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of arcencie1978
Sent: Thursday, April 12, 2007 5:59 PM
To: [EMAIL PROTECTED]
Subject: [flexcoders] What does "Unload swf" mean technically?

 

Hi guys~

I have some question about the message saying "unload swf blah blah 
blah"
shown in the console panel. My question is "what does it mean actually?"
Does it mean that the swf has been actually garbage-collected? Or 
simply does it mean that it has not been garbage-collected yet somehow 
been unloaded?

The reason I have this sort of question is that as far as I know, when 
an application, which is pretty much the same thing with the swf itself 
roughly spkeaking, has an event listener tag, it cannot be garbage 
collected since an event listener added within the tag cannot be 
removed and there'll be always a reference holding onto the application 
in question.

Yet, what I am seeing is that these applications with event listener 
tags still throw "unload swf..." messages. So I feel a little bit 
confused. Can event listeners added within tags be removed? Or can an 
application be unloaded completely,ie garbage-collected, even though
it has some valid listeners? 

Any body please give some hints about all this.. Thanks in advance!!

 

Reply via email to