Files
node/test/parallel/test-external-memory-reasonable-size.js
Filip Skokan 4521f26436 test: avoid allocations in external memory test
Inspect the parsed V8 flags instead of allocating over a gigabyte and
aborting child processes. This avoids memory pressure and core dumps
in test-external-memory-reasonable-size.

Also verify that Node disables the limit by default.

Refs: https://github.com/nodejs/node/pull/65780
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Assisted-by: Codex
PR-URL: https://github.com/nodejs/node/pull/65975
Refs: https://github.com/nodejs/reliability/blob/main/reports/2026-09-11.md
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Richard Lau <richard.lau@ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2026-09-13 07:35:14 +00:00

20 lines
699 B
JavaScript

'use strict';
// Node.js disables V8's external memory reasonable size check by default, but
// explicit values on the command line must still be honored.
// Refs: https://github.com/nodejs/node/issues/65534
require('../common');
const { spawnSyncAndAssert } = require('../common/child_process');
// Despite the "default" label, --v8-options prints the parsed flag values.
for (const [flags, expected] of [
[[], 0],
[['--external-memory-max-reasonable-size=1'], 1],
[['--external_memory_max_reasonable_size=1'], 1],
]) {
spawnSyncAndAssert(process.execPath, [...flags, '--v8-options'], {
stdout: new RegExp(`default: --external-memory-max-reasonable-size=${expected}$`, 'm'),
});
}