You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
v24: discarded vm contexts cause OOM; possible V8 backport #66053
Save as repro.mjs; run node --max-old-space-size=128 repro.mjs.
import{runInNewContext}from"node:vm";import{setImmediate}from"node:timers/promises";constsource=` globalThis.payload = new Array(1_000_000).fill(0);${Array.from({length: 30},(_,index)=>` function work${index}(values) { let result = 0; for (let i = 0; i < values.length; ++i) { result += Math.sqrt(values[i] * values[i] + ${index}); } return result; } `).join("\n")} const values = [1, 2, 3, 4, 5]; for (let i = 0; i < 1000; ++i) {${Array.from({length: 30},(_,index)=>`work${index}(values);`).join("\n")} }`;for(leti=0;i<100;++i){runInNewContext(source+`\n// ${i}`);awaitsetImmediate();}console.log("Completed");
How often does it reproduce? Is there a required condition?
Repeatedly on v24.15.0, v24.16.0, and v24.21.0. Completes on v22.23.2, v26.8.2, or with --no-concurrent-recompilation on v24.
What is the expected behavior? Why is that the expected behavior?
Print Completed; discarded contexts should be collectible.
What do you see instead?
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
Additional information
This surfaced in jsdom’s WPT runner with the default ~4 GB heap; the smaller limit makes this reproduction quick. Sampled heap retainers point through V8’s IdentityMapBase to realm prototypes, keeping entire windows alive.
Activity
Disable unused HTML reports in the WPT runner
inoway46 commentedon Sep 16, 2026
Reproduced with official Linux x64 binaries using the same script and
--max-old-space-size=128:--no-concurrent-recompilationAll v24 default runs exited with
SIGABRT:inoway46 commentedon Sep 17, 2026
I confirmed that backporting the relevant V8 changes fixes the repro on v24.21.0:
https://github.com/inoway46/node/actions/runs/35083804474
I’m preparing a backport PR now and should have it up later.
deps: V8: backport c3553509f460
inoway46 commentedon Oct 11, 2026
Fixed by #66089, which has landed on v24.x-staging. The fix will be included in a future v24.x release.