Jump to content


Release memory when unload SWFs using SWFloader Loadermax

Recommended Posts

Hi !!
I'm using loadermax to load swf, image, ... it so usefull. 

But i have a problem. I can't release memory after loaded SWF file. I can't release memory use load file SWF, it just down a little memory. 

when i use queue.emty (true, true); it just delete a lasted swf file in memory (i don't know why??). Althought i make null applicationdomain! 


This is my code.
I use 

var queue:LoaderMax= new LoaderMax({maxConnections:1});
queue.addEventListener(LoaderEvent.COMPLETE, TotalCompleteHandler);
queue.addEventListener(LoaderEvent.CHILD_PROGRESS, childProgressHandler);
queue.addEventListener(LoaderEvent.CHILD_COMPLETE, childCompleteHandler);
queue.addEventListener(LoaderEvent.PROGRESS, TotalProgressHandler);
queue.addEventListener(LoaderEvent.ERROR, childFailHandler);
var appDomain : ApplicationDomain = new ApplicationDomain();

I run for to load SWF

queue.append(new SWFLoader( (this.serverURL + loadConfig.elements(modul).SWFLoader[i].@url), 
{ 	name:loadConfig.elements(modul).SWFLoader[i].@name, 
	context:new LoaderContext(false, appDomain)
} ));

this is my code to unload all file in SWF:

queue.empty(true, true);
appDomain = null;

when i call Unload all file. i still see SWF files that i was loaded. (i use TheMiner to see file i loaded)

Thanks so much!!!!

Link to comment
Share on other sites

The most likely cause is something in your swf that wasn't cleaned up properly. For example, if it adds event listeners to the stage or starts NetStreams or something like that - there's no way that LoaderMax/SWFLoader can know the code that is run inside the SWF that creates dependencies/references that may prevent GC, so please make sure you clean up those things before calling queue.empty(true, true). 

Link to comment
Share on other sites

Thanks for your answer! 


I did it! 


But I release by this way (because i still don't know how i can't remove all SWF file !!! ): 

I call e.target.dispost(true); when each target download complete.


I just call myApplicationDomain = null; when i want to cleare memory! 

How do you think about my way? it is correct???

Thank you so much! 

Link to comment
Share on other sites

Is that working for you? I'm not entirely sure I understand your question but if it's working I say do it! :)

  • Like 1
Link to comment
Share on other sites

Yes It's working. 

Thank you so much!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.