我使用 node-memwatch 来监控节点应用程序的内存使用情况。简化代码如下
@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()));
});
运行'node test.js',我得到下面的输出。
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 }
有谁知道estimated_base 和current_base 是什么意思?在页面https://github.com/lloyd/node-memwatch中,它们没有详细描述。
问候,
杰弗里