Tag Archive for 'loader'

Garbage Collector troubles using the Loader class.

Just great :( another weird Garbage Collector issue in AS3:

When I load an image using the Loader class and unload it later on. It won’t be disposed by the garbage collector.
There are no references to neither the Loader nor the (weak) eventlisteners. After loading the image a couple of times the memory goes sky high :| .

Here is a (simple) example: loadertest.zip

Does anyone have an explaination on why the GC doesn’t clean the loaded content? I would be very grateful!

UPDATE 1 (2007-06-19):
I made the example even less complicated by using the same Loader instance when loading new images.

As I work around I tried to dispose the loaded BitmapData but unfortunately it had no effect.
I assume the leak is somewhere within the Loader (or even deeper in the code) and that the loaded (binary) data is not removed after it’s converted into a BitmapData.

UPDATE 2 (2007-06-19):
I found the solution on in this post:
http://www.webforumz.com/macromedia-flash/42690-memory-leak-when-loading-swf-in.htm

It seems that the unload() method has a bug when used in the flash IDE. Once I ran the test in a browser there seem to be no more problems and the GC nicely clears the memory…

Lets hope Adobe fixes this problem in the next Flash 9 update.