Skip to content

Instantly share code, notes, and snippets.

@hayes
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hayes/9cd72c430277b811cab4 to your computer and use it in GitHub Desktop.
Save hayes/9cd72c430277b811cab4 to your computer and use it in GitHub Desktop.
var fs = require('fs')
var stream = fs.createWriteStream('test_log.log', {flags: 'w+'})
var buf = new Buffer('im just a little string, log me out and watch mem grow\n', 'utf8')
var start = Date.now()
function log() {
for(var i = 0; i < 1000; i++) {
stream.write(buf)
}
console.log(process.memoryUsage())
if(Date.now() - start < 10000) {
return setImmediate(log)
}
setInterval(function() {
console.log(process.memoryUsage())
}, 1000)
}
log()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment