From 538a00c0f6488d63b7f849a0164e2569c2c4ce85 Mon Sep 17 00:00:00 2001 From: Asaf Federman Date: Thu, 9 Oct 2025 19:23:51 +0300 Subject: [PATCH] test,doc: skip --max-old-space-size-percentage on 32-bit platforms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/60144 Reviewed-By: Richard Lau Reviewed-By: Luigi Pinca Reviewed-By: Ulises Gascón Reviewed-By: Colin Ihrig --- doc/api/cli.md | 9 ++++++--- doc/node.1 | 6 +++++- test/parallel/test-max-old-space-size-percentage.js | 6 +++++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/doc/api/cli.md b/doc/api/cli.md index cc990c01704..3fbfe5dc934 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -1685,14 +1685,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 diff --git a/doc/node.1 b/doc/node.1 index 6210cbf42b2..dad692863f2 100644 --- a/doc/node.1 +++ b/doc/node.1 @@ -333,7 +333,7 @@ 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. @@ -341,6 +341,10 @@ 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. diff --git a/test/parallel/test-max-old-space-size-percentage.js b/test/parallel/test-max-old-space-size-percentage.js index e55c426d7ee..d4da10b3012 100644 --- a/test/parallel/test-max-old-space-size-percentage.js +++ b/test/parallel/test-max-old-space-size-percentage.js @@ -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');