doc: add information for heap snapshot flag

It's nice to have usage examples, especially since the flag requires the
`SIG` version of the signal name, unlike `kill`.

PR-URL: https://github.com/nodejs/node/pull/28754
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Tanner Stirrat 2019-07-18 13:36:12 -06:00 committed by Rich Trott
parent 6c075238b0
commit 4fbefc4283

View File

@ -223,6 +223,19 @@ reference. Code may break under this flag.
added: v12.0.0
-->
Enables a signal handler that causes the Node.js process to write a heap dump
when the specified signal is received.
```console
$ node --heapsnapshot-signal=SIGUSR2 index.js &
$ ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
node 1 5.5 6.1 787252 247004 ? Ssl 16:43 0:02 node --heapsnapshot-signal=SIGUSR2 index.js
$ kill -USR2 1
$ ls
Heap.20190718.133405.15554.0.001.heapsnapshot
```
### `--heap-prof`
<!-- YAML
added: v12.4.0