Created
September 20, 2012 08:29
-
-
Save subzey/3754672 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env node --harmony | |
| var map = new WeakMap(); | |
| var heapStat = { | |
| current: undefined, | |
| max: -Infinity | |
| }; | |
| (function iterate(){ | |
| console.log( | |
| 'Current: %s\tMax: %s', | |
| heapStat.current = process.memoryUsage().heapUsed, | |
| heapStat.max = Math.max(heapStat.current, heapStat.max) | |
| ); // Show Stats | |
| map.set( | |
| {}, // New object as key | |
| {foo: Array(65535).join(0)} // New bulk object as value | |
| ); | |
| setTimeout(iterate, 0); // More GC-friendly than process.nextTick | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment