In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

Memory Test 2 (ちゃんと GC されてる)

Get Adobe Flash player
by Saqoosha 13 Apr 2009
    Embed
/**
 * Copyright Saqoosha ( http://wonderfl.net/user/Saqoosha )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/1nNg
 */

package {
    
    import flash.display.MovieClip;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.system.System;
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
    import flash.text.TextFormat;
    
    import jp.progression.commands.SerialList;
    
    import net.hires.debug.Stats;

    [SWF(width=475, height=475, backgroundColor=0x0, frameRate=120)]

    public class MemoryTest extends Sprite {
        
        private var _debugText:TextField;
        
        public function MemoryTest() {
            var st:Stats = this.addChild(new Stats()) as Stats;
            st.scaleX = st.scaleY = 3;
            this.addEventListener(Event.ENTER_FRAME, this._update);
            
            this._debugText = this.addChild(new TextField()) as TextField;
            this._debugText.defaultTextFormat = new TextFormat('Verdana', 30, 0xffffff, true);
            this._debugText.autoSize = TextFieldAutoSize.RIGHT;
            this._debugText.x = 400;
        }
        
        private function _update(e:Event):void {
            var n:int = 10;
            while (n--) {
//                var cmd:SerialList = new SerialList();
                  var mc:MovieClip = new MovieClip();
            }
            this._debugText.text = System.totalMemory.toString();
        }
    }
}