GeezerVison is showing github.com — doc: add useful v8 option section · nodejs/node@00ce6a3
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: doc/api/cli.md +24Lines changed: 24 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1384,6 +1384,30 @@ threadpool by setting the `'UV_THREADPOOL_SIZE'` environment variable to a value |
1384 | 1384 | greater than `4` (its current default value). For more information, see the |
1385 | 1385 | [libuv threadpool documentation][]. |
1386 | 1386 |
|
| 1387 | +## Useful V8 options |
| 1388 | + |
| 1389 | +V8 has its own set of CLI options. Any V8 CLI option that is provided to `node` |
| 1390 | +will be passed on to V8 to handle. V8's options have _no stability guarantee_. |
| 1391 | +The V8 team themselves don't consider them to be part of their formal API, |
| 1392 | +and reserve the right to change them at any time. Likewise, they are not |
| 1393 | +covered by the Node.js stability guarantees. Many of the V8 |
| 1394 | +options are of interest only to V8 developers. Despite this, there is a small |
| 1395 | +set of V8 options that are widely applicable to Node.js, and they are |
| 1396 | +documented here: |
| 1397 | + |
| 1398 | +### `--max-old-space-size=SIZE` (in Mbytes) |
| 1399 | + |
| 1400 | +Sets the max memory size of V8's old memory section. As memory |
| 1401 | +consumption approaches the limit, V8 will spend more time on |
| 1402 | +garbage collection in an effort to free unused memory. |
| 1403 | + |
| 1404 | +On a machine with 2GB of memory, consider setting this to |
| 1405 | +1536 (1.5GB) to leave some memory for other uses and avoid swapping. |
| 1406 | + |
| 1407 | +```console |
| 1408 | +$ node --max-old-space-size=1536 index.js |
| 1409 | +``` |
| 1410 | + |
1387 | 1411 | [`--openssl-config`]: #cli_openssl_config_file |
1388 | 1412 | [`Buffer`]: buffer.html#buffer_class_buffer |
1389 | 1413 | [`SlowBuffer`]: buffer.html#buffer_class_slowbuffer |
|