2 Replies Latest reply on Nov 27, 2006 2:48 PM by brianraymes

    Memory release?

    jotster
      Whats the prefered way to post code here?

      Im having trouble with memory release I think... the scenario is that a button should toggle an titlewindow on and off. The titlewindow in itself handles some timed remoting (fetch XML documents at an interval) and I dont want to have it running in the background when its not displayed.

      Code follows
      >
      public var helpWindow:IFlexDisplayObject;
      .
      .
      .
      private function showHelp():void {
      // Create a non-modal TitleWindow container.
      if(helpWindow==null) {
      helpWindow = PopUpManager.createPopUp(this, wdwHelp, false);
      } else {
      PopUpManager.removePopUp(helpWindow);
      helpWindow=null;
      }
      }
      .
      .
      .
      <

      When nulling helpWindow, shouldnt memory be released? Because on repeated presses of the "toggle" button I can see that memory usage increases constantly.
        • 1. Re: Memory release?
          inlineblue Level 1
          Note that the Flash Player uses a garbage collector for memory management. Memory is released only when the garbage collector runs, and you have no control as to when that happens.
          • 2. Re: Memory release?
            brianraymes
            quote:

            Originally posted by: inlineblue
            Note that the Flash Player uses a garbage collector for memory management. Memory is released only when the garbage collector runs, and you have no control as to when that happens.


            There is no possible way to force, or activate the garbage collector? Does it only run when it decides the system is low on memory? I have an application that is increasing 5 mbs per click (loads a project with a bunch of pictures). I null everything/clearResults/etc as a new project is selected, but it just keeps growing and growing... Help?