-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
doc: Add useful V8 option section #32262
Changes from 6 commits
0090f54
5209db8
2e86534
2f36d8d
0cf3b11
030fe45
6208729
fd93229
aafe9fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -1385,6 +1385,28 @@ threadpool by setting the `'UV_THREADPOOL_SIZE'` environment variable to a value | |||||
greater than `4` (its current default value). For more information, see the | ||||||
[libuv threadpool documentation][]. | ||||||
|
||||||
## Useful V8 options | ||||||
|
||||||
V8 has its own set of CLI options. Any V8 CLI option that is provided to `node` will | ||||||
be passed on to V8 to handle. V8's options have _no stability guarantee_. | ||||||
The V8 team themselves don't consider them to be part of their formal API, | ||||||
and reserve the right to change them at any time. The Node.js team does not | ||||||
consider them covered by the Node.js stability guarantees. Many of the V8 | ||||||
options are of interest only to V8 developers. Despite this, there is a small | ||||||
set of V8 options that are widely applicable to the Node.js, and they are | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
documented here. V8 options that are allowed are: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
### `--max-old-space-size=SIZE` (in Mbytes) | ||||||
|
||||||
Sets the max memory size of V8 old memory section. As memory | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
consumption approaches the limit, V8 will spend more time on | ||||||
garbage collection in an effort to free unused memory. | ||||||
|
||||||
On a machine with 2GB of memory it suggested to set 1.5GB | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
to leave some memory for other uses and avoid swapping. | ||||||
|
||||||
E.g. `node --max-old-space-size=1536 index.js` | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Optional nit: Delete this line. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I personally feel an example helps a lot when being introduced to a flag. It clearly shows how to pass an argument. @Trott There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If we want to provide an example, it should conform with the formatting of the other examples provided elsewhere in the doc. Otherwise, each entry is inventing its own example formatting, and we definitely do not want that. The existing format is more useful than this as it provides context, such as what the anticipated output might look like. So, this example might show the error one might get if running without the flag, then show the command succeeding with the flag. (That said, most of our entries do not contain examples and that seems appropriate in this document.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Totally agree with your point, Can you point me to some of the correct existing formats?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't mean the format of the command itself. I mean the markdown formatting that denotes an example. ```console
$ node --cpu-prof index.js
$ ls *.cpuprofile
CPU.20190409.202950.15293.0.0.cpuprofile
``` There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Trott can you check out the formatting once now. |
||||||
|
||||||
[`--openssl-config`]: #cli_openssl_config_file | ||||||
[`Buffer`]: buffer.html#buffer_class_buffer | ||||||
[`SlowBuffer`]: buffer.html#buffer_class_slowbuffer | ||||||
|
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.
Optional nit: