mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
PR-URL: https://github.com/nodejs/node/pull/62132 Refs: https://github.com/microsoft/vscode/issues/251777 Refs: https://chromium-review.googlesource.com/c/v8/v8/+/7638233 Reviewed-By: Aditi Singh <aditisingh1400@gmail.com>
22 lines
742 B
JavaScript
22 lines
742 B
JavaScript
// RLIMIT_AS: 21474836480
|
|
// With 20GB virtual memory, there's enough space for the first few wasm memory
|
|
// allocation to succeed, but not enough for many subsequent ones since each
|
|
// wasm memory32 with guard regions reserves 8GB of virtual address space.
|
|
'use strict';
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
|
|
// The first allocation should succeed.
|
|
const first = new WebAssembly.Memory({ initial: 10, maximum: 100 });
|
|
assert(first);
|
|
|
|
// Subsequent allocations should eventually fail due to running out of
|
|
// virtual address space.
|
|
assert.throws(() => {
|
|
const instances = [first];
|
|
for (let i = 1; i < 30; i++) {
|
|
instances.push(new WebAssembly.Memory({ initial: 10, maximum: 100 }));
|
|
}
|
|
}, /WebAssembly\.Memory/);
|