Skip to content
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
9 changes: 6 additions & 3 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -1765,14 +1765,17 @@ changes:

Specify the maximum size, in bytes, of HTTP headers. Defaults to 16 KiB.

### `--max-old-space-size-percentage=PERCENTAGE`
### `--max-old-space-size-percentage=percentage`

Sets the max memory size of V8's old memory section as a percentage of available system memory.
Sets the maximum memory size of V8's old memory section as a percentage of available system memory.
This flag takes precedence over `--max-old-space-size` when both are specified.

The `PERCENTAGE` parameter must be a number greater than 0 and up to 100. representing the percentage
The `percentage` parameter must be a number greater than 0 and up to 100, representing the percentage
of available system memory to allocate to the V8 heap.

**Note:** This flag utilizes `--max-old-space-size`, which may be unreliable on 32-bit platforms due to
integer overflow issues.

```bash
# Using 50% of available system memory
node --max-old-space-size-percentage=50 index.js
Expand Down
6 changes: 5 additions & 1 deletion doc/node.1
Original file line number Diff line number Diff line change
Expand Up @@ -339,14 +339,18 @@ The file used to store localStorage data.
Specify the maximum size of HTTP headers in bytes. Defaults to 16 KiB.
.
.It Fl -max-old-space-size-percentage Ns = Ns Ar percentage
Sets the max memory size of V8's old memory section as a percentage of available system memory.
Sets the maximum memory size of V8's old memory section as a percentage of available system memory.
This flag takes precedence over
.Fl -max-old-space-size
when both are specified.
The
.Ar percentage
parameter must be a number greater than 0 and up to 100, representing the percentage
of available system memory to allocate to the V8 heap.
.Pp
Note: This flag utilizes
.Fl -max-old-space-size ,
which may be unreliable on 32-bit platforms due to integer overflow issues.
.
.It Fl -napi-modules
This option is a no-op.
Expand Down
6 changes: 5 additions & 1 deletion test/parallel/test-max-old-space-size-percentage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

// This test validates the --max-old-space-size-percentage flag functionality

require('../common');
const common = require('../common');
// This flag utilizes --max-old-space-size, which is unreliable on
// 32-bit platforms due to integer overflow issues.
common.skipIf32Bits();

const assert = require('node:assert');
const { spawnSync } = require('child_process');
const os = require('os');
Expand Down
Loading