Use the profiler to see if anything is keeping a reference to the SWF or 
objects in the SWF.

Alex Harui
Flex SDK Developer
Adobe Systems Inc.<http://www.adobe.com/>
Blog: http://blogs.adobe.com/aharui

From: [email protected] [mailto:[email protected]] On Behalf 
Of Patrice O
Sent: Tuesday, May 26, 2009 6:07 AM
To: [email protected]
Subject: [flexcoders] Flex unloading SFW- memory management





Hi all,

I m facing a problem with dynamic loading/unloading of swf. I'm using a
class "mycustomSWFLoader" which extends SWFLoader and which use an instance
of Loader class to load swf files (graphics data) from serialized SWF in
bytearrays.

All seem to be ok, I can display any of my swf, but the flash player does
not free memory (the previous loaded swf) when I load a new swf.

I have tried this approach :

class myCustomSWFLoader extends SWFLoader {
....
public function loadSWF(myByteArray: ByteArray):void {

if(_loader != null) {


// Call the unload & stop on _loader object
_loader.unloadAndStop();

// Call the unload & stop on THIS
unloadAndStop();

} else {
_loader = new Loader();
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
swfLoaded);

MY_CONTAINER.addChild(this);
}


if(myByteArray)
_loader.loadBytes(myByteArray);
else
source = null;

}
...

I'm not sure about how the flash player handdle the unloadAndStop() but what
is sure is that each time I call my method memory usage increases by 2Mb

Any help would be much appreciated !

Thanks by advance

PatriceO

--
View this message in context: 
http://www.nabble.com/Flex-unloading-SFW--memory-management-tp23721843p23721843.html
Sent from the FlexCoders mailing list archive at Nabble.com.

Reply via email to