【问题标题】:What do estimated_base and current_base mean in the stats of the node-memwatch在 node-memwatch 的统计信息中,estimated_base 和 current_base 是什么意思
【发布时间】:2013-06-18 14:07:31
【问题描述】:

我使用 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页面中没有详细描述。

问候,

杰弗里

【问题讨论】:

    标签: node.js memory


    【解决方案1】:

    Memwatch 将其结果分为两个时段。 RECENT_PERIOD 需要 10 次连续 GC,ANCIENT_PERIOD 需要 120 次连续 GC。

    • estimated_base = 执行 10 次连续 GC 后的堆大小。这是 RECENT_PERIOD。
    • current_base = 恰好在 GC 之后的堆大小。
    • base min = 为给定的堆大小记录的最小值 期间。
    • base max = 给定的堆大小记录的最大值 期间。

    如果您点击此链接,您将能够查看代码:Memwatch

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-10
      • 2012-02-25
      • 1970-01-01
      • 1970-01-01
      • 2014-06-24
      • 2012-10-07
      相关资源
      最近更新 更多