|
I'm having some troubles with memory management in an application. It may be an AS3 thing in general, but I wanted to check if there were any specific steps I should follow.
I have a parent application/swf that does not use Box2d that loads in one of 6 child swfs. Two of those .swfs use Box2d as part of their demonstrations and interactivity. Before the child .swf dispatches its event to trigger the parent .swf to unload it, all timers and enterFrame listeners are removed, as well as references to the stage. However, my swfs using Box2d appear to be remaining in memory after the unloadAndStop() and removeChild commands in the parent swf.
Are there any additional steps I need to do to make sure my .swfs using Box2d get cleared out? Do I need to destroy the world as well, or take any additional steps to clear references so the data is available for garbage collection?
I'm unfortunately having to post this from a computer that does not have Flash and will not be able to access the files until tomorrow, but the general idea of the code is:
Child swf:
Timer is stopped and removed. enterFrame listener is removed. Another event listener that references the stage is removed. An event is dispatched to the parent to cue the child swf's removal. -> Parent swf:
The event is received. The event listener for the event is removed. The loader uses unloadAndStop(). The child is removed from the stage. The loader is set to null and the parent swf waits for input.
Would the basic above structure, if it is accurate and I'm not somehow missing a reference to the stage somehow be enough to remove a child swf that's running Box2d, or am I severely neglecting something somewhere?
|