Created
April 22, 2010 01:34
-
-
Save billywhizz/374696 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
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