Add CLI option for specifying heapsnapshot prefix filename #40363
Labels
cli
Issues and PRs related to the Node.js command line interface.
feature request
Issues that request new features to be added to Node.js.
stale
The CLI option
--heapsnapshot-near-heap-limit
was introduced to Node.js 14.18.0 in #33010. Although this works as expected, i have a usecase where i would like to predefine how the heapsnapshot file will be named (when it goes out of memory).The usecase is about a main node process forking several child processes. When one of those goes out of memory, i would like to know which one it is (based on the given prefix filename).
See #33010 (comment).
Desired behavior
Have a new CLI option called
--heapsnapshot-filename-prefix
which is used to prepend the default filename (Heap.YYYYMMDD.HHmmSS.${pid}.${threadid}.${count}.heapsnapshot
).For example:
node --heapsnapshot-filename-prefix=FooHeapsnapshot --heapsnapshot-near-heap-limit=1
would lead toFooHeapsnapshot.YYYYMMDD.HHmmSS.${pid}.${threadid}.${count}.heapsnapshot
when an out of memory occurs.Current alternative
Current workaround would be to keep track of a forked process process id, and use that to rename a possible heapsnapshot when the process has exited.
The text was updated successfully, but these errors were encountered: