7 Replies Latest reply on Sep 7, 2006 7:10 PM by yaroze

    Loader Class memory leak?

    ozmic66
      Hello all

      I'm trying to tackle this problem and its driving me crazy
      any help would be greatly appriciated

      I'm creating a loader class and loading an image into it
      then I try to free up the memory space that it took up, and nothing does it

      here's my code

      ----------------------------------------------
      quote:


      var loader:Loader = new Loader()
      var req:URLRequest = new URLRequest(' http://www.fisixengine.com/time.jpg')

      btnLoad.addEventListener(MouseEvent.CLICK,loadClick)
      btnUnload.addEventListener(MouseEvent.CLICK,unloadClick)

      addEventListener(Event.ENTER_FRAME,onEnterFrame)

      function onLoadComplete(e:Event){
      txt2.text="image loaded"
      }

      function loadClick(e:MouseEvent){
      loader.load(req)
      txt2.text="loading image"
      }
      function unloadClick(e:MouseEvent){
      loader.contentLoaderInfo.content.bitmapData.dispose()
      loader.unload()
      try {
      new LocalConnection().connect('foo');
      new LocalConnection().connect('foo');
      } catch (e:*) {}
      }

      function onEnterFrame(e:Event){
      txt.text = System.totalMemory
      }

      When I press the load button, System.totalMemory goes up, but when i press btnUnload, it only goes down by a little bit

      How would I get it to completely unload the picture?

      Any help would be greatly appriciated