Skip to content

Commit 0a6c1de

Browse files
committed
cli: add --heap-prof flag available to NODE_OPTIONS
Fixes: nodejs#54257 Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
1 parent 2bcf999 commit 0a6c1de

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

doc/api/cli.md

+4
Original file line numberDiff line numberDiff line change
@@ -2932,6 +2932,10 @@ one is included in the list below.
29322932
* `--force-fips`
29332933
* `--force-node-api-uncaught-exceptions-policy`
29342934
* `--frozen-intrinsics`
2935+
* `--heap-prof-dir`
2936+
* `--heap-prof-interval`
2937+
* `--heap-prof-name`
2938+
* `--heap-prof`
29352939
* `--heapsnapshot-near-heap-limit`
29362940
* `--heapsnapshot-signal`
29372941
* `--http-parser`

src/node_options.cc

+8-4
Original file line numberDiff line numberDiff line change
@@ -604,19 +604,23 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
604604
"Start the V8 heap profiler on start up, and write the heap profile "
605605
"to disk before exit. If --heap-prof-dir is not specified, write "
606606
"the profile to the current working directory.",
607-
&EnvironmentOptions::heap_prof);
607+
&EnvironmentOptions::heap_prof,
608+
kAllowedInEnvvar);
608609
AddOption("--heap-prof-name",
609610
"specified file name of the V8 heap profile generated with "
610611
"--heap-prof",
611-
&EnvironmentOptions::heap_prof_name);
612+
&EnvironmentOptions::heap_prof_name,
613+
kAllowedInEnvvar);
612614
AddOption("--heap-prof-dir",
613615
"Directory where the V8 heap profiles generated by --heap-prof "
614616
"will be placed.",
615-
&EnvironmentOptions::heap_prof_dir);
617+
&EnvironmentOptions::heap_prof_dir,
618+
kAllowedInEnvvar);
616619
AddOption("--heap-prof-interval",
617620
"specified sampling interval in bytes for the V8 heap "
618621
"profile generated with --heap-prof. (default: 512 * 1024)",
619-
&EnvironmentOptions::heap_prof_interval);
622+
&EnvironmentOptions::heap_prof_interval,
623+
kAllowedInEnvvar);
620624
#endif // HAVE_INSPECTOR
621625
AddOption("--max-http-header-size",
622626
"set the maximum size of HTTP headers (default: 16384 (16KB))",

test/parallel/test-cli-node-options.js

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ expectNoWorker(`-r ${JSON.stringify(printSpaceA)}`, 'A\nB\n');
2222
expectNoWorker(`-r ${printA} -r ${printA}`, 'A\nB\n');
2323
expectNoWorker(` -r ${printA} -r ${printA}`, 'A\nB\n');
2424
expectNoWorker(` --require ${printA} --require ${printA}`, 'A\nB\n');
25+
expect('--heap-prof', 'B\n');
2526
expect('--no-deprecation', 'B\n');
2627
expect('--no-warnings', 'B\n');
2728
expect('--no_warnings', 'B\n');

0 commit comments

Comments
 (0)