Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ;
- import cpp.Lib;
- import cpp.vm.WeakRef;
- class MemoryMonster
- {
- public var food:Array<Float>;
- public function new()
- {
- food = [];
- for (i in 0...50000)
- food.push(Math.random());
- }
- }
- /**
- *
- */
- class Main
- {
- static function main()
- {
- var list = [];
- trace("Allocating some memory monsters. Evolution will pick the strongest!");
- for (i in 0...3000)
- list.push(new WeakRef(new MemoryMonster()));
- trace("Let's see who survived natural selection.");
- for (i in 0...list.length)
- trace(list[i].get());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment