RE: [Flashcoders] [AS3] Memory leaks unloading
Hi Henry, I've found that even if items are garbage collected in the Flash Player memory will be necessarily be freed in the browser. If you want to check for garbage collection you can use the Flex Profiler (In Flex Builder 3) to check whether items are collected or not. What you will most likely find is that your items are being gc'd but Flash is unable to free up the memory. We had an application loading in a large game and trying to unload it. Although the game was garbage collected most of the memory was not freed up. In the end we gave up trying to get Flash to load/unload large amounts of data since we didn't believe it was able to release memory well enough. Hope that helps! Sunil -Original Message- From: Henry Cooke [mailto:[EMAIL PROTECTED] Sent: 12 March 2008 17:25 To: Flash Coders List Subject: Re: [Flashcoders] [AS3] Memory leaks unloading Wow, thanks for all the tips, guys. I forgot to mention that I was removing all my listeners, too, but weak referencing definitely looks useful, as does the rest of the stuff that Mr Skinner's written on resource management. And I'll dig into my copy of Moock as soon as I get the chance. Thanks again! Any more suggestions welcome, of course ;) On 12/03/2008, Matthew James Poole [EMAIL PROTECTED] wrote: True, but its sounds like Henry has lots of stuff not marked for GC so he still has references somewhere, just a case of finding them... Easier said than done -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Allandt Bik-Elliott (Receptacle) Sent: 12 March 2008 16:30 To: Flash Coders List Subject: Re: [Flashcoders] [AS3] Memory leaks unloading as far as i know, there is no way of dumping the garbage manually - you have to wait for the flash plugin to dump it once it has been marked you can check chapter 14 of essential actionscript 3.0 (moock) for more info about that On 12 Mar 2008, at 15:54, Henry Cooke wrote: 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 Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com 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
RE: [Flashcoders] [AS3] Memory leaks unloading
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 Flashcoders@chattyfig.figleaf.com 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 Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] [AS3] Memory leaks unloading
as far as i know, there is no way of dumping the garbage manually - you have to wait for the flash plugin to dump it once it has been marked you can check chapter 14 of essential actionscript 3.0 (moock) for more info about that On 12 Mar 2008, at 15:54, Henry Cooke wrote: 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 Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] [AS3] Memory leaks unloading
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 Flashcoders@chattyfig.figleaf.com 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 Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] [AS3] Memory leaks unloading
True, but its sounds like Henry has lots of stuff not marked for GC so he still has references somewhere, just a case of finding them... Easier said than done -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Allandt Bik-Elliott (Receptacle) Sent: 12 March 2008 16:30 To: Flash Coders List Subject: Re: [Flashcoders] [AS3] Memory leaks unloading as far as i know, there is no way of dumping the garbage manually - you have to wait for the flash plugin to dump it once it has been marked you can check chapter 14 of essential actionscript 3.0 (moock) for more info about that On 12 Mar 2008, at 15:54, Henry Cooke wrote: 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 Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com 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 Flashcoders@chattyfig.figleaf.com http
Re: [Flashcoders] [AS3] Memory leaks unloading
I think you can use a localconnection hack to force gc. http://blog.infidea.ws/category/as3/ On Wed, Mar 12, 2008 at 4:29 PM, Allandt Bik-Elliott (Receptacle) [EMAIL PROTECTED] wrote: as far as i know, there is no way of dumping the garbage manually - you have to wait for the flash plugin to dump it once it has been marked you can check chapter 14 of essential actionscript 3.0 (moock) for more info about that On 12 Mar 2008, at 15:54, Henry Cooke wrote: 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 Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] [AS3] Memory leaks unloading
Wow, thanks for all the tips, guys. I forgot to mention that I was removing all my listeners, too, but weak referencing definitely looks useful, as does the rest of the stuff that Mr Skinner's written on resource management. And I'll dig into my copy of Moock as soon as I get the chance. Thanks again! Any more suggestions welcome, of course ;) On 12/03/2008, Matthew James Poole [EMAIL PROTECTED] wrote: True, but its sounds like Henry has lots of stuff not marked for GC so he still has references somewhere, just a case of finding them... Easier said than done -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Allandt Bik-Elliott (Receptacle) Sent: 12 March 2008 16:30 To: Flash Coders List Subject: Re: [Flashcoders] [AS3] Memory leaks unloading as far as i know, there is no way of dumping the garbage manually - you have to wait for the flash plugin to dump it once it has been marked you can check chapter 14 of essential actionscript 3.0 (moock) for more info about that On 12 Mar 2008, at 15:54, Henry Cooke wrote: 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 Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com 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
Re: [Flashcoders] [AS3] Memory leaks unloading
In Flex Builder 3 they have added the profiler. You can use that to take snapshots of your application and inspects its memory use, instantiated objects etc. Greetz Erik On 3/12/08, Henry Cooke [EMAIL PROTECTED] wrote: Wow, thanks for all the tips, guys. I forgot to mention that I was removing all my listeners, too, but weak referencing definitely looks useful, as does the rest of the stuff that Mr Skinner's written on resource management. And I'll dig into my copy of Moock as soon as I get the chance. Thanks again! Any more suggestions welcome, of course ;) ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders