Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: add --node-memory-debug option #35537

Merged
merged 1 commit into from
Oct 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,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
Expand Down Expand Up @@ -1282,6 +1290,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`
Expand Down
4 changes: 4 additions & 0 deletions doc/node.1
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,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
Expand Down
6 changes: 6 additions & 0 deletions src/node_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,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) {
Expand Down