Hi all, this is my first post here, even I usually read the threads with much interest. I've been following the discussion about the FP9 problem regarding to memory use and removing loaded assets, which I find very important since I work in a large project with hundreds of large loaded assets.

I've been doing an experiment today with a simple movie. You can download it from http://www.hamoid.com/RamTest.fla If you run it in the IDE, it traces memory increase since the beginning, and it is pretty stable (does increase very little).

BUT if you edit the MC found in the library called "Inside" and drag all key frames from frame 3 to frame 1 and run the experiment again, the used ram increases at a few Kb / sec. all the time. Is this something I should worry about? We have lots of these assets loaded and if each uses more and more ram...

I found out about this ram increase while trying to develop a small class our designers could use to pause movieclips for a random amout of time. You can see the code "new Pause(this, 1, 10);" commented at frames 1 and 12 of the MC "Inside". The source code for the Pause class is:

package {
   import flash.display.*;
   import flash.events.TimerEvent;
   import flash.utils.Timer;

   public class Pause {
       private var pDisp:MovieClip;
public function Pause(tDisp:MovieClip, tMin:Number, tMax:Number) {
           pDisp = tDisp;
           pDisp.stop();

           var tDiff:Number = tMax - tMin;
var tTimer:Timer = new Timer(1000 * (tMin + Math.random() * tDiff), 1);
           tTimer.addEventListener(TimerEvent.TIMER, onTimer);
tTimer.start(); }
       private function onTimer(tEvent:TimerEvent):void {
           pDisp.play();
           pDisp = null;
       }
   }
}

Some questions: If I use "new Pause(this, 1, 10);" in a frame, without storing it into a variable, it could be garbage collected right? Testing this file alone works as expected, but maybe in a large project I should do "var p:Pause = new Pause(this, 1, 10);" so it's not removed by accident. But in this second case, aren't we piling lots of Pause objects? Or are the old ones recycled automatically because no one references them?

What happens to all the "new Timer"? Are they deleted for the same reason? They only run 1 time, and are stored in a temporary variable...

I wish we could have a callback executed when an object is garbage collected, then we could know what's going on, otherwise we don't know if things get deleted or not (execept if we use the profiler in FB).

Thanks, Abe
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to