You should read this. http://gskinner.com/blog/archives/2006/07/as3_resource_ma_1.html
GC doesnt happen on unloading immediately. Leave your app open for 20 mins and see what happens... MaTT On Wed, Mar 12, 2008 at 4:14 PM, Matthew James Poole < [EMAIL PROTECTED]> wrote: > You can start by using weak references for you events listeners... > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Henry > Cooke > Sent: 12 March 2008 15:55 > To: Flashcoders mailing list > Subject: [Flashcoders] [AS3] Memory leaks & unloading > > Hey all, > > I'm currently working on a Flash module to sit inside a larger Flash > site being developed by another agency. This module needs to be loaded > and unloaded as needed, and has a fair few library assets, quite > substantial codebase and will be running PV3D or Away3D, so I need to be > very careful about destroying everything when my module is finished > with; the container site is pretty resource-hungry too. > > So, my current problem: I've built initialisation and destruction > routines that run on Event.ADDED_TO_STAGE and Event.REMOVED_FROM_STAGE, > and a test loader which loads and removes my module. However, watching > the test loader unload my module in the Flash Player shows no noticeable > drop in memory after my destructors have been called in the module and > $loader.unload() has been called in the test loader, so it seems like a > lot o stuff is gettign stuck in memory. > > Basically, my destructors set any class variables which reference > objects to null, which I believe should mark them for garbage > collection, if nothing else points to them? I also do things like > removeChild() and bitmapData.dispose() where relevant. > > I've compiled in XRay, which shows what you'd expect: various bits > present on stage while my module is loaded, all gone when it's not. > > So I guess my questions are: does anyone know any secret voodoo > techniques to track down memory use in the Flash player? Is there > anything better I can be doing than just setting pointers to null? > Back in the AS2 day, I'd suspect the _global namespace of becoming > cluttered and just try and nuke _global[ package_name ], but dirty hacks > like that don't exist in our shiny new AS3 world, do they? > > I'd be grateful if anyone can offer any advice about how to properly > clear up memory after unloading my module. This is my first AS3 project, > and none of my old tricks work :( > > Cheers, > Henry > _______________________________________________ > Flashcoders mailing list > [email protected] > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > ______________________________________________________________________ > This e-mail has been scanned for viruses by the Virtual Universe e-mail > security system - powered by MessageLabs. > http://www.virtual-universe.net > > ______________________________________________________________________ > > The contents of this email (which include its attachments) are > confidential and may be subject to legal privilege and protected by > copyright. If you are not the intended recipient any use, copying or > disclosure of this e-mail to any third party is strictly forbidden by the > sender and we reserve all rights and remedies against any person or entity > making any such unauthorised use. If you have received this email in error, > please contact the sender immediately by telephone or return the email to > the sender and then delete this email and any copies of it on your system. > Virtual Universe Limited may monitor the contents of emails sent and > received via its network for viruses and to ensure the lawful and authorised > use of its systems. Virtual Universe Limited will not be held responsible > for any damage caused by viruses which may be transmitted upon receipt of > this email or the opening of any attachment thereto. Any views or opinions > presented in this email are solely those of th! > e author and do not necessarily represent those of Virtual Universe > Limited. > > Virtual Universe Limited is a company established under the laws of > England and Wales with registered number 03064568 and has its registered > office at 1 Regent Street, London, SW1Y 4NW and principal place of business > at 28-39 The Quadrant, 135 Salusbury Road, London NW6 6RJ, United Kingdom. > It is registered for VAT in the United Kingdom with number GB877113217. > > > ______________________________________________________________________ > This e-mail has been scanned for viruses by the Virtual Universe e-mail > security system - powered by MessageLabs. http://www.virtual-universe.net > > _______________________________________________ > Flashcoders mailing list > [email protected] > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

