-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Closed
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.v8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency.vmIssues and PRs related to the vm subsystem.Issues and PRs related to the vm subsystem.
Description
Version
14 / 16
Platform
x64 macOS / Linux
Subsystem
vm
What steps will reproduce the bug?
'use strict';
let times = 0;
function run() {
let str = 'var a = "';
for (let i = 0; i < 100 * 1024 / 18; i++) str += Math.random().toString();
str += '";';
const script = new (require('vm').Script)(str);
times++;
if (times % 1000 === 0) console.log(times);
}
(async () => {
while (true) {
run();
await new Promise(resolve => {
setTimeout(() => {
resolve();
}, 10);
});
gc();
}
})();
Run with:
$ node --expose-gc --max-heap-size=100 test.js
It will occur heap OOM under Node.js 14 and 16, and Node.js 12 is OK.
<--- Last few GCs --->
[1430950:0x55695b1dc4b0] 6372 ms: Mark-sweep 72.0 (91.6) -> 71.6 (91.8) MB, 4.3 / 0.0 ms (average mu = 0.728, current mu = 0.778) testing GC in old space requested
[1430950:0x55695b1dc4b0] 6388 ms: Mark-sweep 72.2 (91.8) -> 71.8 (92.1) MB, 3.1 / 0.0 ms (average mu = 0.760, current mu = 0.804) testing GC in old space requested
[1430950:0x55695b1dc4b0] 6403 ms: Mark-sweep 72.4 (92.1) -> 72.0 (92.3) MB, 2.9 / 0.0 ms (average mu = 0.781, current mu = 0.806) testing GC in old space requested
<--- JS stacktrace --->
FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory
How often does it reproduce? Is there a required condition?
Every time.
What is the expected behavior?
Not OOM.
What do you see instead?
OOM.
Additional information
No response
ycjcl868, s0j0hn, reduardo7, viceice, blackrabbit99 and 56 mores0j0hn, kirillgroshkov, mbelsky, jonahsnider, cdaringe and 4 more
Metadata
Metadata
Assignees
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.v8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency.vmIssues and PRs related to the vm subsystem.Issues and PRs related to the vm subsystem.