-
Notifications
You must be signed in to change notification settings - Fork 29.1k
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
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Whoops, this needs some tweaks. I'll work on them tomorrow |
doc/api/cli.md
Outdated
|
||
```js | ||
// If the --expose-gc flag is provided, V8 will expose the garbage collector | ||
// allowing users to trigger garbage collection on demand. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer that we don't document this because what "trigger garbage collection" means is usually not what users expected (the kind of garbage collection that gc()
does isn't very eager, it can leave unreachable objects around, which isn't a bug because it's only invented for V8's tests and only cater to what their tests need, which may on the other hand require a single round of GC. But that can be very surprising to users expecting or even relying on it to "clean up all the garbage in the heap if they are already unreachable"). We already saw that happenning to Jest's leak detector (even after doing gc()
10 times it can still produce false positives) #48510 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can remove the docs, or specify that is for testing purposes only and it is not meant to be ran in productive environments. Or do u have any suggestion for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to not documenting as Joyee suggests.
With #53078 (comment) in mind, is there a legitimate use case for the flag? |
Debugging heap size. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with the documentation removed.
Ok, docs are gone now |
This commits allows users to send `--expose-gc` via `NODE_OPTIONS` environment variable. Using `node --expose-gc` is possible but via `NODE_OPTIONS` won't work. ```sh NODE_OPTIONS='--expose-gc' node node: --expose-gc is not allowed in NODE_OPTIONS ``` Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
Landed in b26a260 |
This commits allows users to send `--expose-gc` via `NODE_OPTIONS` environment variable. Using `node --expose-gc` is possible but via `NODE_OPTIONS` won't work. ```sh NODE_OPTIONS='--expose-gc' node node: --expose-gc is not allowed in NODE_OPTIONS ``` Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com> PR-URL: #53078 Reviewed-By: Tierney Cyren <hello@bnb.im> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
This commits allows users to send `--expose-gc` via `NODE_OPTIONS` environment variable. Using `node --expose-gc` is possible but via `NODE_OPTIONS` won't work. ```sh NODE_OPTIONS='--expose-gc' node node: --expose-gc is not allowed in NODE_OPTIONS ``` Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com> PR-URL: nodejs#53078 Reviewed-By: Tierney Cyren <hello@bnb.im> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
This commits allows users to send `--expose-gc` via `NODE_OPTIONS` environment variable. Using `node --expose-gc` is possible but via `NODE_OPTIONS` won't work. ```sh NODE_OPTIONS='--expose-gc' node node: --expose-gc is not allowed in NODE_OPTIONS ``` Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com> PR-URL: nodejs#53078 Reviewed-By: Tierney Cyren <hello@bnb.im> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
This commits allows users to send
--expose-gc
viaNODE_OPTIONS
environment variable.Using
node --expose-gc
is possible but viaNODE_OPTIONS
won't work.