Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gcstats.js

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gcstats.js

Exposes node v8 garbage collection stats

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
17K
decreased by-27.74%
Maintainers
1
Weekly downloads
 
Created
Source

gcstats

Exposes stats about V8 GC after it has been executed.

Build Status

Usage

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

var gcStats = require('gcstats.js');

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

This will print blobs like this whenever a GC happens:

GC happened { start: 635817864674795,
  end: 635817865774643,
  gctype: 1,
  before:
   { totalHeapSize: 277510912,
     totalHeapExecutableSize: 5242880,
     usedHeapSize: 273621856,
     heapSizeLimit: 1535115264,
     totalPhysicalSize: 277510912 },
  after:
   { totalHeapSize: 277510912,
     totalHeapExecutableSize: 5242880,
     usedHeapSize: 273533760,
     heapSizeLimit: 1535115264,
     totalPhysicalSize: 277510912 } }

Property insights

  • totalHeapSize: Number of bytes V8 has allocated for the heap. This can grow if usedHeap needs more.
  • usedHeapSize: Number of bytes in use by application data
  • total HeapExecutableSize: Number of bytes for compiled bytecode and JITed code
  • heapSizeLimit: The absolute limit the heap cannot exceed
  • totalPhysicalSize: Commited size (node 0.11+)
  • pause: Nanoseconds from start to end of GC using hrtime()

gctype can have the following values:

  • 1: Scavenge (minor GC)
  • 2: Mark/Sweep/Compact (major GC)
  • 3: Both 1 and 2

Installation

npm install --save gcstats.js

Node version compatibility

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 and the compatibility file.

Credits

node-gcstats was written by @dainis and later adopted by @bripkens.

FAQs

Package last updated on 03 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc