Jump to content
Search Community

Memory Leaks With Subloaded SWF

FlashGameDev test
Moderator Tag

Recommended Posts

I have a game that subloads a SWF, plays for a while, then pops off that SWF and loads up another, repeating this behavior. We have been trying to track down a memory leak with this process which is preventing the subloaded SWF from being garbage collected.

 

I discovered your site and tried implementing LoaderMax thinking it may be the savior to my memory leak problems, but after implementing it, it would seem the subloaded SWF is still not being cleaned up (even with calling the unload method on your LoaderMax object).

 

Was I wrong in assuming LoaderMax could somehow clean up a subloaded SWF even if there may be lingering references to the stage, or some type of cyclic reference that is preventing the garbage collector from cleaning up the SWF?

 

What should I be on the lookout for so that I can get the subloaded SWF's memory freed up?

Link to comment
Share on other sites

Unfortunately, it's simply impossible to do what you're asking because there's no way that a 3rd party tool like LoaderMax can assess all the other code you wrote and clean up after you, like remove event listeners, closing NetStreams/NetConnections, nulling references from the root that point at your subloaded swf, etc. Of course LoaderMax does its best, but it can't work miracles :)

 

It sounds like you need to analyze your own code to find the leaks/references and clean them up before you unload. Remember to close NetStreams and NetConnections, don't keep references to the subloaded swf or any of its content, and remove listeners. 

 

Good luck!

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.
×
×
  • Create New...