title: Memory leak when loading SWF
body: <p>I have a loader SWF that runs some code in the background and loads other SWFs. Using this code:</p>
  
  <pre><code>private function loadScreensaver():void {
              screensaverSWF = new Loader();
              var req:URLRequest;
              switch(areaNumber){
                  case 1 :
                      req = new URLRequest("exNorthernFrontierScreensaver.swf");
                      break;
                  case 2 :
                      req = new URLRequest("exRomanEmpireScreensaver.swf");
                      break;
                  case 3 :
                      req = new URLRequest("exRomanCarlisleScreensaver.swf");
                      break;
                  case 4 :
                      req = new URLRequest("exRomanBritainScreensaver.swf");
                      break;
              }
              screensaverSWF.load(req);
              addChild(screensaverSWF);
              GAME_STATE = SCREENSAVER;
          }
  </code></pre>
  
  <p>I load the screensaver and add it to the stage. Using MonsterDebugger I can see that memory steadily rises from around 80mb upwards until the application exits (Im using windows projector). What I can't work out is why, there is no code attached to the screensaver SWF, just some timeline animations of things fading in and out.
  Any idea what's going on here?</p>
  
  <p>EDIT:
  I've kept testing and found where I have an image that starts of stage then tweens on and off and is removed. When it loops it adds to memory again, as if the first image is still kept. This is all done on the timeline.</p>
  
  <p>EDIT2:
  <a href="http://www.rezmason.net/blog/caching-timeline-objects-in-flash" rel="nofollow">http://www.rezmason.net/blog/caching-timeline-objects-in-flash</a> This appears to be the problem but doesn't give a solution. This screensaver could run up to 6 hours a day, at the moment it exits after 2.</p>