Skip to content

Instantly share code, notes, and snippets.

@billywhizz
Created April 22, 2010 01:34
Show Gist options
  • Save billywhizz/374696 to your computer and use it in GitHub Desktop.
Save billywhizz/374696 to your computer and use it in GitHub Desktop.
var buffer = require("buffer");
var gc = require("./gc");
var sys = require("sys");
function showmem() {
var mem = process.memoryUsage();
sys.puts("RSS:" + parseInt(mem.rss/(1024*1024)));
}
var mb = 100;
if(process.ARGV[2]) mb = process.ARGV[2];
var buffsize = mb*1024*1024;
var buff = "";
for(var i=0; i<1024*1024; i++) {
buff += "0";
}
setTimeout(function() {
var b1 = new buffer.Buffer(buffsize);
for(var i=0; i<mb; i++) {
b1.write(buff, "ascii", i*1024*1024);
}
sys.puts("WRITTEN:" + b1.toString("ascii", 0, b1.length).length);
process.nextTick(arguments.callee);
}, 0);
setInterval(function() {
showmem();
}, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment