Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import flash.events.TimerEvent;
- import flash.system.System;
- import flash.utils.Timer;
- ///
- class Main {
- static function main():Void {
- var timer:Timer = new Timer(1000);
- timer.addEventListener(TimerEvent.TIMER, onTimer);
- timer.start();
- }
- static function getOne(v:Dynamic):Void {
- untyped __global__["flash.utils.setTimeout"](function() { v = null; }, 10);
- }
- static function onTimer(_):Void {
- for (i in 0 ... 1024) getOne(new One());
- // Show memory usage:
- trace(System.totalMemory / (1024 * 1024) + "MB");
- }
- }
- /// Holds a useless 1024-element array of integers
- class One {
- public var ints:Array<Int>;
- public function new() {
- ints = []; for (i in 0 ... 1024) ints.push(Std.int(Math.random() * 0x10000));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement