Skip to content

Instantly share code, notes, and snippets.

@T-X
Created June 25, 2016 01:56
Show Gist options
  • Save T-X/99b18a3bb1667568245f823dcd19149f to your computer and use it in GitHub Desktop.
Save T-X/99b18a3bb1667568245f823dcd19149f to your computer and use it in GitHub Desktop.
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