Last active
January 3, 2016 01:49
-
-
Save ErisDS/8391533 to your computer and use it in GitHub Desktop.
Heapdump code.
Plug this into Ghost's index.js to instrument Ghost & inspect memory usage.
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 heapdump = require('heapdump'); | |
var nextMBThreshold = 0; | |
function recordMemory() { | |
var usage = process.memoryUsage(); | |
var memMB = usage.rss / 1048576; | |
console.log('MEMORY', usage); | |
if (memMB > nextMBThreshold) { | |
heapdump.writeSnapshot(); | |
nextMBThreshold += 100; | |
} | |
} | |
setInterval(recordMemory, 6000 * 2); | |
recordMemory(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
// without the heapdump