Box2D Forums

It is currently Fri May 24, 2013 8:11 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Sun Jun 26, 2011 9:10 pm 
Offline

Joined: Sun Apr 17, 2011 1:07 pm
Posts: 1
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?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group