Home

Awesome

NB!

V1.4.0 was using s3 for prebuilt binaries that is not associated with project anymore use v1.4.0 at your own risk

GCStats

Build Status Build status

Exposes stats about V8 GC after it has been executed.

Usage

Create a new instance of the module and subscribe to stats-events from that:

var gc = (require('gc-stats'))();

gc.on('stats', function (stats) {
    console.log('GC happened', stats);
});

This will print blobs like this whenever a GC happened:

GC happened {
  startTime: 9426055813976,
  endTime: 9426057735390,
  pause: 1921414,
  pauseMS: 1,
  gctype: 1,
  before: {
     totalHeapSize: 11354112,
     totalHeapExecutableSize: 3670016,
     usedHeapSize: 7457184,
     heapSizeLimit: 1501560832,
     totalPhysicalSize: 9725880,
     totalAvailableSize: 1488434544,
     mallocedMemory: 8192,
     peakMallocedMemory: 1186040
  },
  after: {
     totalHeapSize: 12402688,
     totalHeapExecutableSize: 3670016,
     usedHeapSize: 6485792,
     heapSizeLimit: 1501560832,
     totalPhysicalSize: 10166144,
     totalAvailableSize: 1489388528,
     mallocedMemory: 8192,
     peakMallocedMemory: 1186040
  },
  diff: {
     totalHeapSize: 1048576,
     totalHeapExecutableSize: 0,
     usedHeapSize: -971392,
     heapSizeLimit: 0,
     totalPhysicalSize: 440264,
     totalAvailableSize: 953984,
     mallocedMemory: 0,
     peakMallocedMemory: 0
  }
}

Property insights

Installation

npm install gc-stats

Node version support

node-gcstats depends on C++ extensions which are compiled when the gc-stats module is installed. Compatibility information can be inspected via the Travis-CI build jobs.