Created
October 17, 2010 13:23
-
-
Save FrankGrimm/630848 to your computer and use it in GitHub Desktop.
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
var printMemoryUsage = function() { | |
var spawn = require('child_process').spawn, | |
getconf = spawn('getconf', ['PAGESIZE']); | |
getconf.stdout.on('data', function (data) { | |
var pageSize = parseInt(data, 10); | |
console.log('Page size: ' + pageSize); | |
var procOutput = spawn('cat', ['/proc/' + process.pid + '/status']); | |
procOutput.stdout.on('data', function (data) { | |
console.log("/proc/self"); | |
data.toString('ascii').split('\n').some(function(line) { | |
if (line.toLowerCase().indexOf('rss') > 0) { | |
console.log(line); | |
return true; | |
} | |
}); | |
}); | |
}); | |
} | |
printMemoryUsage(); | |
console.log("process.memoryUsage():"); | |
console.log(process.memoryUsage()); | |
console.log("KB: " + (process.memoryUsage().rss/1024)); |
{ rss: 195428352
, vsize: 8523776
, heapTotal: 3141632
, heapUsed: 2203364
}
KB: 191232
/proc/self
VmRSS: 11996 kB
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
process.memoryUsage():
{ rss: 168558592
, vsize: 8478720
, heapTotal: 3141632
, heapUsed: 2147252
}
KB: 165568