Created
February 20, 2012 13:51
-
-
Save youurayy/1869292 to your computer and use it in GitHub Desktop.
quick-testing node/v8 memory/object limits
This file contains 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
/* | |
node --max_old_space_size=3000 --prof nodemem.js | |
# --trace_incremental_marking=true --incremental_marking_steps=false | |
node --max_old_space_size=3000 --max_new_space_size=3000 --max_executable_size=1000 --gc_global --prof nodemem.js | |
# --noincremental_marking | |
# --nolazy_sweeping | |
# --never_compact | |
# --gc_global | |
# --gc_interval=100000000 | |
*/ | |
var utilz = require('utilz') | |
var objs = 100000000; | |
var arr = [], a = [] | |
arr.push(a) | |
var start = Date.now() | |
for(var i = 0; i < objs; i++) { | |
a.push({ r: true }) | |
if(i % 1000000 === 0) { | |
console.log(i) | |
a = [] | |
arr.push(a) | |
} | |
} | |
var end = Date.now() | |
var dur = utilz.timeSpan(end - start) | |
var mem = process.memoryUsage() | |
mem.rss = utilz.formatNumber(mem.rss) | |
mem.heapTotal = utilz.formatNumber(mem.heapTotal) | |
mem.heapUsed = utilz.formatNumber(mem.heapUsed) | |
console.log(utilz.formatNumber(objs) + ' objects allocated; rss(' + mem.rss + ') heapTotal(' + | |
mem.heapTotal + ') heapUsed(' + mem.heapUsed + ') in ' + dur) |
Author
youurayy
commented
Feb 20, 2012
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment