View Full Version : Garbage collection?
MaryAnneL
08-06-2008, 12:42 PM
Hello all. I'm just getting started with AS3 and have heard experienced Flash developers talk about 'garbage collection'. Can anyone explain in simple terms what this is and what I should do to make sure I don't have lots of wasted memory in my projects?
Thanks!
MA
senocular
08-06-2008, 12:52 PM
The idea of garbage collection is that you don't have to worry about managing the memory in your applications - at least not as much. Flash includes a "garbage collector" (GC) algorythm that goes through and automatically removes from memory the values you are no longer using. Without it, you would have to make sure to clean up after yourself a lot more, and the processes on when and how to do that can get really complicated. The GC makes life a lot easier.
It's not without its problems though. For the GC to work, it needs to know when it can clean up. And for that there are some certain conditions that need to be met. For more information on that, read skinners 3 part article:
http://gskinner.com/blog/archives/2006/06/as3_resource_ma.html
Paul Ferrie
08-06-2008, 12:52 PM
The garbage collection collection runs in the background. it should remove any code/objects/listeners from memroy when they are no longer needed or being used. most probably you will have herd it in reference to the flash 9 failure to unload. you can read more about it and garbage collection here (http://gskinner.com/blog/archives/2008/04/failure_to_unlo.html).
hope it helps
MaryAnneL
08-06-2008, 01:15 PM
Thanks senocular and Paul. I will read up on this. Must be this garbage collector is new is AS3? I used AS2 for a while and never heard of such a thing. If I needed to load then unload movie clips it was easy.
I think AS3 is a bit more complicated, especially loading, unloading and cleaning up movie clips or external swf files.
Thanks!
MA
Paul Ferrie
08-06-2008, 01:23 PM
You never had to give garbage collection a second thought in AS2 player 8 as there wasnt this issue there is now with player 9.
senocular
08-06-2008, 03:14 PM
similar issues exist in AS2 as well. They just weren't as prevelent because of the constrictive nature of display objects in the AS2 version of the display list
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.