From 06991cd9023b8e00989d3b78844274deebd14b45 Mon Sep 17 00:00:00 2001 From: Tanner Stirrat Date: Thu, 18 Jul 2019 13:36:12 -0600 Subject: [PATCH] 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 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca --- doc/api/cli.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/doc/api/cli.md b/doc/api/cli.md index 544a3acb16ce7d..d63749819eb10b 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -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`