Oct1a

Node.js-v8

v8.getHeapStatistics()

用来获取内存使用情况

const v8 = require('v8');
const statics = v8.getHeapStatistics();
console.log(statics);

输出如下:

{
  total_heap_size: 9961472,
  total_heap_size_executable: 1572864,
  total_physical_size: 6266656,
  total_available_size: 1518883592,
  used_heap_size: 4943008,
  heap_size_limit: 1526909922,
  malloced_memory: 8192,
  peak_malloced_memory: 4818552,
  does_zap_garbage: 0
}

本作品采用 知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议 进行许可。