Browse Source

Kill memwatch

dev/git-series/gccdum
Matt Godbolt 7 years ago
parent
commit
cab75f7c7a
  1. 35
      app.js
  2. 1
      package.json

35
app.js

@ -63,40 +63,6 @@ function compilerProps(property, defaultValue) {
require('./lib/compile').initialise(gccProps, compilerProps);
var staticMaxAgeMs = gccProps('staticMaxAgeMs', 0);
function initializeMemwatch() {
var memwatch = require('memwatch-next');
console.log("Initial GC");
memwatch.gc();
// Everything else happens a little later to let the initial GC finish.
setTimeout(function () {
var lastDiff = new memwatch.HeapDiff();
memwatch.on('leak', function (info) {
console.log("Memwatch leak: " + JSON.stringify(info));
});
memwatch.on('stats', function (stats) {
console.log("Memwatch stats: " + JSON.stringify(stats));
});
var heapDiffEverySecs = gccProps('gcHeapDiffEverySecs', 0);
if (heapDiffEverySecs) {
console.log("Diffing heap every " + heapDiffEverySecs + "s");
setInterval(function () {
var diff = lastDiff.end();
lastDiff = new memwatch.HeapDiff();
console.log("Memwatch diff from last stats: " + JSON.stringify(diff));
}, 1000 * heapDiffEverySecs);
}
var gcIntervalSecs = gccProps("gcIntervalSecs", 0);
if (gcIntervalSecs) {
console.log("Forcing a GC every " + gcIntervalSecs + "s");
setInterval(function () {
memwatch.gc();
}, 1000 * gcIntervalSecs);
}
}, 1 * 1000);
}
function loadSources() {
var sourcesDir = "lib/sources";
var sources = fs.readdirSync(sourcesDir)
@ -376,7 +342,6 @@ findCompilers().then(function (compilers) {
console.log("=======================================");
console.log("Listening on http://" + os.hostname() + ":" + port + "/");
console.log("=======================================");
initializeMemwatch();
webServer.listen(port);
}).catch(function (err) {
console.log("Error: " + err.stack);

1
package.json

@ -23,7 +23,6 @@
"fs-extra": "0.26.x",
"http-proxy": "1.12.x",
"lru-cache": "2.7.x",
"memwatch-next": "0.2.x",
"morgan": "1.6.x",
"promise": "7.0.x",
"promise-queue": "2.1.x",

Loading…
Cancel
Save