Skip to content

Instantly share code, notes, and snippets.

@fcamel
Created August 10, 2015 06:31
Show Gist options
  • Save fcamel/79673a206293a7b57c25 to your computer and use it in GitHub Desktop.
Save fcamel/79673a206293a7b57c25 to your computer and use it in GitHub Desktop.
Test ndoe.js memory usage
/*
usage: nodejs test_memory_by_reading_file.js LARGE_FILE
It looks no memory limit for the process with node.js v0.10.38,
but single project cannot use more than ~2G.
*/
var sleep = require('sleep');
var fs = require('fs');
var bs = [];
for (var i = 0; i < 10; i++) {
var b = fs.readFileSync(process.argv[2]);
console.log(b.toString());
bs.push(b);
}
sleep.sleep(1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment