# gc-profiler

> Allows you to profile when the garbage collector runs, and how long it takes.

Latest version **1.4.2** (published 2021-08-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install gc-profiler
pnpm add gc-profiler
yarn add gc-profiler
bun add gc-profiler
```

## Health

**Score 18/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.2 |
| Published | 2021-08-24 |
| First published | 2014-09-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/gc-profiler) |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 191 |
| Author | Bret Copeland |
| Maintainers | rossipedia, bretcope, orgads |
| Keywords | gc, garbage, profile, performance |

## Links

- npm: https://www.npmjs.com/package/gc-profiler
- Repository: https://github.com/bretcope/node-gc-profiler
- Homepage: https://github.com/bretcope/node-gc-profiler#readme
- Issues: https://github.com/bretcope/node-gc-profiler/issues
- npm.io page: https://npm.io/package/gc-profiler

## Dependencies (1)

- [nan](https://npm.io/package/nan.md) ^2.15.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.4.2 (latest) — 2021-08-24
- 1.4.1 — 2019-07-25
- 1.4.0 — 2017-03-14
- 1.3.1 — 2015-09-09
- 1.3.0 — 2015-09-04
- 1.2.0 — 2015-03-07
- 1.1.1 — 2015-02-19
- 1.1.0 — 2014-09-26
- 1.0.2 — 2014-09-24
- 1.0.1 — 2014-09-24
- 1.0.0 — 2014-09-24

## README

# node-gc-profiler

A cross-platform (tested on Linux, Windows, and OSX) profiler for the v8 garbage collector running inside Node.js. It will emit an event after every GC cycle providing you information about the duration and type of cycle.

```
npm install gc-profiler
```

Example:

```js
var profiler = require('gc-profiler');
profiler.on('gc', function (info) {
  console.log(info);
});
```

The `info` object contains the following properties:

| Property | Type | Description |
| -------- | ---- | ----------- |
| date | Date | The approximate start time of the GC cycle. This uses the c++ time library internally, which only has one-second resolution. |
| duration | number | The duration of the GC cycle in milliseconds. |
| type | string | Either `Scavenge` or `MarkSweepCompact` depending on the type of GC cycle. |
| forced | boolean | True for a forced cycle. |
| flags | number | The raw GCCallbackFlags provided from v8. |

The `profiler.GCCallbackFlags` enumeration is provided to help decode the `flags` property.

```js
profiler.GCCallbackFlags = {
  kNoGCCallbackFlags: 0,
  kGCCallbackFlagCompacted: 1 << 0, // this flag is never set in v8 versions >= 3.6.5
  kGCCallbackFlagConstructRetainedObjectInfos: 1 << 1,
  kGCCallbackFlagForced: 1 << 2
};
```

---
_Source: https://npm.io/package/gc-profiler · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
