Closed nathang0147 closed 1 month ago
There are certain classes of scripts which v8 simply cannot preempt. The Array methods are particularly vulnerable to this. I reported Array.prototype.join
to the team 5 years ago which is still open today. https://issues.chromium.org/issues/42212548
I would suspect Array.prototype.fill
is the same
Edit: Actually that issue linked is about Array.prototype.fill
. The same issue you reported here. I don't think they're going to fix it. The best option is to polyfill Array.prototype.fill
with a pure-JS implementation.
Thank you all for your help! Your insights on memory limits and handling isolate disposal really helped me resolve the issue in my project. I’ve successfully implemented a solution based on the suggestions here. Closing this now—thanks again!
Description: I am experiencing an issue with
isolated-vm
where the memory limit set for an isolate is not being enforced correctly during memory-intensive operations. Even though the memory limit is specified, the isolate continues executing until it crashes due to an out-of-memory error, without triggering the expectedMemoryLimitExceeded
error when memory usage exceeds the limit.Steps to Reproduce:
MemoryLimitExceeded
error is not thrown, and the isolate eventually crashes due to out-of-memory.Expected Behavior:
MemoryLimitExceeded
error.Actual Behavior:
Example Code:
What I've Tried:
getHeapStatistics()
in a setInterval, but the memory usage still spikes beyond the limit without triggering theMemoryLimitExceeded
error.Environment:
Personal Diagnostics: This code will parse and evaluate if I put it into a file called
main.mjs
and then run nodemain.mjs
. Yes, JavaScript includes asetTimeout
function. Yes, functions are a type of primitive value in JavaScript. No, objects cannot be shared between isolates.