Skip to content

Commit 66aafcf

Browse files
nimit95targos
authored andcommitted
doc: add useful v8 option section
This adds new section for v8 options and --max-old-space-size Fixes: #32252 PR-URL: #32262 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
1 parent c8a007f commit 66aafcf

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

doc/api/cli.md

+24
Original file line numberDiff line numberDiff line change
@@ -1419,6 +1419,30 @@ threadpool by setting the `'UV_THREADPOOL_SIZE'` environment variable to a value
14191419
greater than `4` (its current default value). For more information, see the
14201420
[libuv threadpool documentation][].
14211421

1422+
## Useful V8 options
1423+
1424+
V8 has its own set of CLI options. Any V8 CLI option that is provided to `node`
1425+
will be passed on to V8 to handle. V8's options have _no stability guarantee_.
1426+
The V8 team themselves don't consider them to be part of their formal API,
1427+
and reserve the right to change them at any time. Likewise, they are not
1428+
covered by the Node.js stability guarantees. Many of the V8
1429+
options are of interest only to V8 developers. Despite this, there is a small
1430+
set of V8 options that are widely applicable to Node.js, and they are
1431+
documented here:
1432+
1433+
### `--max-old-space-size=SIZE` (in Mbytes)
1434+
1435+
Sets the max memory size of V8's old memory section. As memory
1436+
consumption approaches the limit, V8 will spend more time on
1437+
garbage collection in an effort to free unused memory.
1438+
1439+
On a machine with 2GB of memory, consider setting this to
1440+
1536 (1.5GB) to leave some memory for other uses and avoid swapping.
1441+
1442+
```console
1443+
$ node --max-old-space-size=1536 index.js
1444+
```
1445+
14221446
[`--openssl-config`]: #cli_openssl_config_file
14231447
[`Buffer`]: buffer.html#buffer_class_buffer
14241448
[`SlowBuffer`]: buffer.html#buffer_class_slowbuffer

0 commit comments

Comments
 (0)