diff --git a/doc/api/cli.md b/doc/api/cli.md index 6e0702498a105b..d7747d50beb451 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -537,6 +537,14 @@ added: v6.0.0 Silence all process warnings (including deprecations). +### `--node-memory-debug` +<!-- YAML +added: REPLACEME +--> + +Enable extra debug checks for memory leaks in Node.js internals. This is +usually only useful for developers debugging Node.js itself. + ### `--openssl-config=file` <!-- YAML added: v6.9.0 @@ -1278,6 +1286,7 @@ Node.js options that are allowed are: * `--no-deprecation` * `--no-force-async-hooks-checks` * `--no-warnings` +* `--node-memory-debug` * `--openssl-config` * `--pending-deprecation` * `--policy-integrity` diff --git a/doc/node.1 b/doc/node.1 index 319532f50ecfa7..e7bc59b26a8008 100644 --- a/doc/node.1 +++ b/doc/node.1 @@ -281,6 +281,10 @@ These will still be enabled dynamically when `async_hooks` is enabled. .It Fl -no-warnings Silence all process warnings (including deprecations). . +.It Fl -node-memory-debug +Enable extra debug checks for memory leaks in Node.js internals. This is +usually only useful for developers debugging Node.js itself. +. .It Fl -openssl-config Ns = Ns Ar file Load an OpenSSL configuration file on startup. Among other uses, this can be used to enable FIPS-compliant crypto if Node.js is built with diff --git a/src/node_options.cc b/src/node_options.cc index 3c9fe815dffb37..5219f93155f690 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -770,6 +770,12 @@ PerProcessOptionsParser::PerProcessOptionsParser( kAllowedInEnvironment); Insert(iop, &PerProcessOptions::get_per_isolate_options); + + AddOption("--node-memory-debug", + "Run with extra debug checks for memory leaks in Node.js itself", + NoOp{}, kAllowedInEnvironment); + Implies("--node-memory-debug", "--debug-arraybuffer-allocations"); + Implies("--node-memory-debug", "--verify-base-objects"); } inline std::string RemoveBrackets(const std::string& host) {