Browse Source

trying to correlate app restarts

fix-133-memory-crash
Dan Janosik 7 years ago
parent
commit
b4389b73a9
  1. 9
      app.js

9
app.js

@ -79,13 +79,22 @@ function refreshExchangeRate() {
} }
} }
var firstCall = true;
function trackMemoryUsage() { function trackMemoryUsage() {
var mbUsed = process.memoryUsage().heapUsed / 1024 / 1024; var mbUsed = process.memoryUsage().heapUsed / 1024 / 1024;
mbUsed = Math.round(mbUsed * 100) / 100; mbUsed = Math.round(mbUsed * 100) / 100;
var stream = fs.createWriteStream("memoryUsage.csv", {flags:'a'}); var stream = fs.createWriteStream("memoryUsage.csv", {flags:'a'});
if (firstCall) {
stream.write("App starting up.");
}
stream.write(new Date().toISOString() + "," + mbUsed + "\n"); stream.write(new Date().toISOString() + "," + mbUsed + "\n");
stream.end(); stream.end();
firstCall = false;
} }

Loading…
Cancel
Save