# Loader Memory Leak

**URL:** <https://forum.kirupa.com/t/loader-memory-leak/300405>\
**Category:** flash\
**Created:** [November 20, 2009, 2:21pm UTC](https://forum.kirupa.com/t/loader-memory-leak/300405 "2009-11-20T14:21:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![flashisland](https://avatars.discourse-cdn.com/v4/letter/f/8c91f0/32.png) [@flashisland](https://forum.kirupa.com/u/flashisland)\
**Post date:** [November 20, 2009, 2:21pm UTC](https://forum.kirupa.com/t/loader-memory-leak/300405/1 "2009-11-20T14:21:35Z")

</div>

While tracking down the source of a memory leak, I stumbled upon a strange issue with AS 3.0 and loading external flash movies. From what I can tell this somehow related to the custom classes stored inside the loaded movie. I have two versions of a basic file that contains one image on the stage (I also tried this with vector graphics with the same effect). One version has a custom document class (just a simple extends MovieClip with no additional code) and the other has no document class.

The graph below depicts the memory usage from loading the file without a document class. It performs the garbage collection as you would expect after each unload operation.

![](http://www.digitalstrawberry.net/memory-leak/image1.jpg)

However when I try to load and unload the same file with a document class, I get the following memory usage graph. As you can see, memory usage is slowly creeping up with each load operation.

![](http://www.digitalstrawberry.net/memory-leak/image2.jpg)

It almost seems that Flash is caching the class files, so I tried changing the application domain for the loaded content without success. Even if Flash was caching the class files I would assume that it would be able to detect that it had already cached the document class and simply re-load the cached version. Any ideas on what is going on here?
