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 --expose-gc flag available to NODE_OPTIONS #53078

Merged
merged 1 commit into from
Jun 4, 2024
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
20 changes: 20 additions & 0 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,23 @@ Make built-in language features like `eval` and `new Function` that generate
code from strings throw an exception instead. This does not affect the Node.js
`node:vm` module.

### `--expose-gc`

<!-- YAML
added: REPLACEME
-->

> Stability: 1 - Experimental. This flag is inherited from V8 and is subject to
> change upstream.

This flag will expose the gc extension from V8.

```js
if (globalThis.gc) {
globalThis.gc();
}
```

### `--dns-result-order=order`

<!-- YAML
Expand Down Expand Up @@ -2776,6 +2793,7 @@ V8 options that are allowed are:
* `--abort-on-uncaught-exception`
* `--disallow-code-generation-from-strings`
* `--enable-etw-stack-walking`
* `--expose-gc`
* `--huge-max-old-generation-size`
* `--interpreted-frames-native-stack`
* `--jitless`
Expand Down Expand Up @@ -3098,6 +3116,8 @@ documented here:

### `--enable-etw-stack-walking`

### `--expose-gc`

### `--harmony-shadow-realm`

### `--huge-max-old-generation-size`
Expand Down
1 change: 1 addition & 0 deletions src/node_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
AddOption("--experimental-report", "", NoOp{}, kAllowedInEnvvar);
AddOption(
"--experimental-wasi-unstable-preview1", "", NoOp{}, kAllowedInEnvvar);
AddOption("--expose-gc", "expose gc extension", V8Option{}, kAllowedInEnvvar);
AddOption("--expose-internals", "", &EnvironmentOptions::expose_internals);
AddOption("--frozen-intrinsics",
"experimental frozen intrinsics support",
Expand Down
1 change: 1 addition & 0 deletions test/parallel/test-cli-node-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ if (common.hasCrypto) {
// V8 options
expect('--abort_on-uncaught_exception', 'B\n');
expect('--disallow-code-generation-from-strings', 'B\n');
expect('--expose-gc', 'B\n');
expect('--huge-max-old-generation-size', 'B\n');
expect('--jitless', 'B\n');
expect('--max-old-space-size=0', 'B\n');
Expand Down