# Loading as2 files and mem usage

**URL:** https://forum.kirupa.com/t/loading-as2-files-and-mem-usage/246559
**Category:** Uncategorized
**Created:** [December 12, 2007, 9:48am UTC](https://forum.kirupa.com/t/loading-as2-files-and-mem-usage/246559 "2007-12-12T09:48:57Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![zworp](https://avatars.discourse-cdn.com/v4/letter/z/f9ae1b/32.png) [@zworp](https://forum.kirupa.com/u/zworp)
#### Post date: [December 12, 2007, 9:48am UTC](https://forum.kirupa.com/t/loading-as2-files-and-mem-usage/246559/1 "2007-12-12T09:48:57Z")

</div>

I’m working on a as3 app that showing a slide show with a bunch of as2 banners.  
BannerA load, is shown for x seconds, then BannerB is loaded, and so on.  
The problem is that for every new banner I load the System.totalMemory is increased with 100-500kb, the old banners that I’m no longer showing seems to stay in memory and is not removed by the GC.  
The slide show is looping so after a while the mem usage gets really high.

This is the function that runs when a new banners has finished loading

```auto

private function imgComplete(img:DisplayObject):void{
            
    if(_activePromo != null){
        removeChild(_activePromo);
        _activePromo.mask = null;
        _activePromo = null; //this doesn’t seem to remove it.
    }
            
    _activePromo = img;
    addChild(_activePromo);        
    _activePromo.mask = _mask;
            
    if(_promos.length > 1)
        setTimeout(loadPromo, _showtime);
        
}

```

Is there any other reference to \_activePromo that I need to remove?  
I’ve removed the listeners to the Loader object that loads it (and then reference to the Loader itself).

thanks.
