I use the node-memwatch to monitor the memory usage of the node application. The simplified code is as below
@file test.js
var memwatch = require('memwatch');
var util = require('util');
var leak = [];
setInterval(function() {
leak.push(new Error("leak string"));
}, 1);
memwatch.on('stats', function(stats) {
console.log('MEM watch: ' + JSON.stringify(stats));
console.log('Process: ' + util.inspect(process.memoryUsage()));
});
Run 'node test.js', I get the output below.
MEM watch: {"num_full_gc":1,"num_inc_gc":6,"heap_compactions":1,"usage_trend":0,"estimated_base":8979176,"current_base":8979176,"min":0,"max":0}
Process: { rss: 28004352, heapTotal: 19646208, heapUsed: 9303856 }
Does anyone know what do the estimated_base and current_base mean? In the page https://github.com/lloyd/node-memwatch, they are not described detailedly.
Regards,
Jeffrey
Memwatch splits its results into two Periods. The RECENT_PERIOD which takes 10 consecutive GCs and the ANCIENT_PERIOD which is 120 consecutive GCs.
If you follow this link you will be able to check out the code: Memwatch