1 Reply Latest reply on Sep 11, 2006 10:18 AM by katerini

    Problem with delete and removeChild

    wouitmil
      Hi,

      I use in one of my app this code to add Children in a "windowed like app".
      The problem is that after a "deleter" and a "removeAllChildren". The children object still living and using a lot of memory (still refreshing data in quite huge datagrid).
      We can only refresh Mozilla to get it cleared.

      What can I do?


      var classe:Class = getClassByAlias(nodeApp); // Old Version nécéssitait: registerClasAlias
      var disp:Array = AccessData.myDatas.parentApp.intranet.canvas.getChildren()
      var obj:DisplayObject = new classe();

      for(var i:int =0;i<disp.length;i++)
      {
      AccessData.myDatas.parentApp.intranet.canvas.removeAllChildren();
      delete disp
      }

      // THE NEXT LINE SHOWS ME THAT THE OBJECT IS NOT KILLED
      Canvas(obj).addEventListener(Event.ENTER_FRAME, function():void{trace(obj)})

      AccessData.myDatas.parentApp.intranet.canvas.addChildAt(obj,0);


        • 1. Re: Problem with delete and removeChild
          katerini
          You can try forcing the garbage collector to execute with the following lines of code (got it from gskinner.com/blog):
          try {
          new LocalConnection().connect('foo');
          new LocalConnection().connect('foo');
          } catch (e:*) {}
          // the GC will perform a full mark/sweep on the second call.

          maybe this will do the trick for you,

          -george