5 Replies Latest reply on Apr 29, 2011 1:58 PM by Flex harUI

    Memory not being released when calling unloadAndStop on the SWFLoader

    mtlw

      I am using the following code to create, load and unload a very simple sub application.  Using the memory profiler I am not seeing the SimpleSubApplication memory released when the unloadSubApp() method is called.  I was wondering if anyone has any suggestions around why the memory is not being released and how to resolve it.


      Thanks

       

                  private function loadSubApp():void {

       

                      var loaderContext:LoaderContext = new LoaderContext();

                      loaderContext.securityDomain = SecurityDomain.currentDomain;

                      loaderContext.applicationDomain = new ApplicationDomain( ApplicationDomain.currentDomain.parentDomain );

                      this._contentLoader = new SWFLoader();

                      this._contentLoader.loaderContext = loaderContext;               

                      _contentLoader.source = "SimpleSubApplication.swf";

                      _contentLoader.addEventListener( Event.COMPLETE, completeHandler );

                                            
                      myPanel2.addChild(_contentLoader);

                }

       

       

                  private function unloadSubApp () : void {
                      myPanel2.removeChild(_contentLoader);
                     
                      _contentLoader.unloadAndStop(true);
                      _contentLoader = null;
                  }