gcstats.js is a Node.js package that provides granular statistics about V8 garbage collection events. It exposes a native binding that emits 'stats' events whenever a garbage collection cycle completes, detailing various heap metrics before and after the GC, including `totalHeapSize`, `usedHeapSize`, `totalHeapExecutableSize`, `heapSizeLimit`, `totalPhysicalSize`, and the `gctype` (Scavenge, Mark/Sweep/Compact, or both). The current stable version is 1.0.0. While there isn't a stated release cadence, updates are typically driven by compatibility requirements with new Node.js V8 engine versions or bug fixes. Its key differentiator is direct access to low-level V8 GC information, which is otherwise difficult to obtain without `--expose-gc` flags and manual polling, making it invaluable for performance monitoring and debugging memory-intensive Node.js applications.
npm install gcstats.jsVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to initialize gcstats.js and subscribe to 'stats' events, logging detailed garbage collection metrics including type, pause duration, and heap usage before/after. It includes a robust memory allocation simulation to reliably trigger and showcase GC events.
After updating Node.js, run `npm rebuild gcstats.js` or `npm install gcstats.js` to recompile the native module. Always consult the project's `compatibility.md` for specific Node.js version support and known issues.
Ensure you have the required build tools for `node-gyp` installed on your operating system. For Windows, consider `npm install --global windows-build-tools`. For Linux/macOS, ensure development packages like `build-essential` (Debian/Ubuntu) or Xcode Command Line Tools (macOS) are installed.
Strictly use `require('gcstats.js')` in your code and `npm install gcstats.js` for package management to avoid module resolution errors.Execute `npm rebuild gcstats.js` or `npm install gcstats.js` in your project directory to recompile the native module against your current Node.js version. Ensure `node-gyp` prerequisites are met.
Review the installation logs carefully for `node-gyp` errors. Ensure all required build tools are installed. Try running `npm install gcstats.js` again, potentially with `--force` or clearing npm cache.
Install the necessary build tools as per `node-gyp`'s documentation for your operating system. Common solutions include `npm install --global windows-build-tools` on Windows, or installing `build-essential` on Linux and Xcode Command Line Tools on macOS.
No dependency data recorded yet.