4 Replies Latest reply on Sep 4, 2008 9:27 AM by Oliver Goldman

    Calling/using a variable from inside a function,,  does Adobe Air garbage collect the variable when function finishes

    seme1 Level 1
      What if the local variable was a reference to a library class ? will it still be freed from memory after function finishes execution ?
      The following code resides in one single function:
      =================================================
      var bd =new air.BitmapData(500,400);
      bd.draw(tmploader); //tmploader is a new air.loader
      var encoder = new window.runtime.com.pfp.utils.JPEGAsyncEncoder();
      encoder.PixelsPerIteration = 128;
      encoder.encode(bd);
      =============================================
      It seems like encoder.encode(bd); is causing memory leakage. When commented out (and leaving everything else intact),, the memory leakage symptoms go away.

      The function containing the above code is executed several times (called from within a for loop) to encode JPEG images asynchronously.

      Any hints what could the problem ?