Skip to content

Commit 52da293

Browse files
juanarboladuh95
authored andcommitted
cli: add --heap-prof flag available to NODE_OPTIONS
Fixes: #54257 Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com> PR-URL: #54259 Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
1 parent 0da1632 commit 52da293

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

doc/api/cli.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3075,6 +3075,10 @@ one is included in the list below.
30753075
* `--force-fips`
30763076
* `--force-node-api-uncaught-exceptions-policy`
30773077
* `--frozen-intrinsics`
3078+
* `--heap-prof-dir`
3079+
* `--heap-prof-interval`
3080+
* `--heap-prof-name`
3081+
* `--heap-prof`
30783082
* `--heapsnapshot-near-heap-limit`
30793083
* `--heapsnapshot-signal`
30803084
* `--http-parser`

src/node_options.cc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -617,19 +617,23 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
617617
"Start the V8 heap profiler on start up, and write the heap profile "
618618
"to disk before exit. If --heap-prof-dir is not specified, write "
619619
"the profile to the current working directory.",
620-
&EnvironmentOptions::heap_prof);
620+
&EnvironmentOptions::heap_prof,
621+
kAllowedInEnvvar);
621622
AddOption("--heap-prof-name",
622623
"specified file name of the V8 heap profile generated with "
623624
"--heap-prof",
624-
&EnvironmentOptions::heap_prof_name);
625+
&EnvironmentOptions::heap_prof_name,
626+
kAllowedInEnvvar);
625627
AddOption("--heap-prof-dir",
626628
"Directory where the V8 heap profiles generated by --heap-prof "
627629
"will be placed.",
628-
&EnvironmentOptions::heap_prof_dir);
630+
&EnvironmentOptions::heap_prof_dir,
631+
kAllowedInEnvvar);
629632
AddOption("--heap-prof-interval",
630633
"specified sampling interval in bytes for the V8 heap "
631634
"profile generated with --heap-prof. (default: 512 * 1024)",
632-
&EnvironmentOptions::heap_prof_interval);
635+
&EnvironmentOptions::heap_prof_interval,
636+
kAllowedInEnvvar);
633637
#endif // HAVE_INSPECTOR
634638
AddOption("--max-http-header-size",
635639
"set the maximum size of HTTP headers (default: 16384 (16KB))",

test/parallel/test-process-env-allowed-flags-are-documented.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,18 @@ const difference = (setA, setB) => {
8686
return new Set([...setA].filter((x) => !setB.has(x)));
8787
};
8888

89+
// Remove heap prof options if the inspector is not enabled.
90+
// NOTE: this is for ubuntuXXXX_sharedlibs_withoutssl_x64, no SSL, no inspector
91+
// Refs: https://github.com/nodejs/node/pull/54259#issuecomment-2308256647
92+
if (!process.features.inspector) {
93+
[
94+
'--heap-prof-dir',
95+
'--heap-prof-interval',
96+
'--heap-prof-name',
97+
'--heap-prof',
98+
].forEach((opt) => documented.delete(opt));
99+
}
100+
89101
const overdocumented = difference(documented,
90102
process.allowedNodeEnvironmentFlags);
91103
assert.strictEqual(overdocumented.size, 0,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy