-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
Description
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 to FooHeapsnapshot.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.