Skip to content

Commit 1ad5010

Browse files
authored
Update README.md
Include use of --heap-snapshot-on-oom for node 22
1 parent 515b307 commit 1ad5010

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ Also comes with prebuilt binaries (hosted on Github releases), thanks to Stuart
1212
From 3.1.0, prebuilt binaries are only shipped for Node.js 16.x and upwards.
1313
From 3.2.3, prebuilt binaries are only shipped for Node.js 18.x and upwards.
1414

15+
## Node 22.x
16+
Since node 22.x, there is a new CLI flag for generating heapdumps. This one is supplied by V8 (not Node.js) and is more reliant and efficient in creating the heapdumps than Node.js' `--heapsnapshot-near-heap-limit`.
17+
More information: https://github.com/nodejs/node/issues/50711#issuecomment-2149559816
18+
19+
```
20+
node --heap-snapshot-on-oom index.js
21+
```
22+
Since node 22.x we had issues with no heapdumps being created in production sometimes (via `--heapsnapshot-near-heap-limit`), which did work when using V8's `--heap-snapshot-on-oom`.
23+
The only disadvantage i encountered is that the filename of the heapdump file does not include a process ID, just the timestamp.
24+
1525
## Node.js 14.18.x
1626
https://github.com/nodejs/node/pull/33010 landed in Node.js 14.18.0, which makes this module no longer needed for heapdumps on out of memory.
1727
One can use the `--heapsnapshot-near-heap-limit` Node.js CLI option as an alternative.

0 commit comments

Comments
 (0)