1 Reply Latest reply on Nov 20, 2009 1:02 PM by NateNielsen

    SWFLoader Memory - At my wits end! Ugh!

    NateNielsen Level 1

      I am pulling my hair out trying to make sense of why SWFLoader controls consume so much memory?


      I'm trying to load SWF's that are pages of a document.  Each page is about 100k in size.  In this example, I'm loading 100 pages (the same page actually).


      I fully understand that 100 * 200k = 20MB of memory.  Lets assume the SWFLoader has a *ton* of overhead - 1MB of memory per instance - that math still means the app shouldn't consume more than 120MB of memory - but in this instance it is consuming up to 1GB of memory!!


      I can't / don't understand what is going on or why it would consume this much memory.


      When you first load the example, all is well (sort of at somewhere around 80MB of memory).  However, if you click and drag the scroll thumb up and down slowly, you'll see your memory balloon to well over 1GB of memory - and continue to balloon until crash.


      Note that I'm not attaching *any* event handlers or even attempting to unload anything(!)  This is as plain vanilla as it gets!


      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
                     import mx.controls.SWFLoader;
                     private function loadDocs() : void {
                          var sl : SWFLoader;
                          for(var i : uint = 1 ; i < 100; i++){
                               sl = holder.addChild( new SWFLoader() ) as SWFLoader;
                               sl.load('e514508fa074478cbef52d2662925246_1.swf' );                    
           <mx:VBox height="100%" width="100%">
                <mx:HBox width="100%" height="100">
                     <mx:Button click="loadDocs()" label="load docs"/>
                <mx:VBox id="holder" height="{this.height - 130}" width="{this.width - 30}"/>


      Attached is the test document I'm loading.. so you can try this for yourself.


      I just can't figure out what is going on or how to approach this any differently.


      I know it is Friday and we've all checked out at this point mentally, but if anyone can please help me solve this, I'll paypal you a $100 bounty instantly to buy you and yours a few rounds on me over the weekend (and saving my sanity)!  


      Thanks for any ideas you have in advance