Created
June 25, 2016 01:56
-
-
Save T-X/99b18a3bb1667568245f823dcd19149f 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 EstimoteSticker = require('./estimote-sticker'); | |
var heapdump = require('heapdump'); | |
EstimoteSticker.on('discover', function(estimoteSticker) { | |
// console.log(estimoteSticker); | |
}); | |
EstimoteSticker.startScanning(); | |
function gcAndStats() { | |
try { | |
global.gc(); | |
} catch (e) { | |
console.log("xxx For periodic garbage collection, you must run with 'node --expose-gc'"); | |
process.exit(); | |
} | |
var heapUsed = process.memoryUsage().heapUsed; | |
console.log("xxx heapUsed:" + heapUsed); | |
// creates a heapdump file in the running directory, heapdump listens to SIGUSR2 | |
process.kill(process.pid, "SIGUSR2"); | |
} | |
// Garbage collection and then a heapdump every 60 seconds | |
setInterval(gcAndStats, 60000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment