/**
* Flash player has a Memory Leak?
* Conclusion: No, in this case the GC can take hours until it cleans up.
**/
package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.system.Capabilities;
import flash.system.System;
import flash.text.TextField;
import flash.text.TextFormat;
/**
* @author mrdoob
*/
public class Test extends Sprite
{
private var text : TextField;
private var info : String;
private var mem : uint;
private var mem_max : uint;
private var mem_min : uint;
public function Test()
{
text = new TextField();
text.width = 500;
text.height = 500;
text.defaultTextFormat = new TextFormat("_sans", 30);
addChild(text);
info = Capabilities.version.split(" ")[0] + " " + Capabilities.version.split(" ")[1];
mem_min = System.totalMemory;
addEventListener(Event.ENTER_FRAME, loop);
}
private function loop(e : Event) : void
{
mem = System.totalMemory;
mem_max = Math.max( mem_max, mem);
mem_min = Math.min( mem_min, mem);
text.text = "INFO: " + info + "\nMIN: " + mem_min + "\nMEM: " + mem + "\nMAX: " + mem_max;
}
}
}