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
Commit 356aa3c
Browse filesBrowse the repository at this point in the historyBrowse files
Adds Node's `resourceLimits` worker option, at the top level of the options
object rather than under `ios`:
new Worker("./w.js", {
resourceLimits: {
maxOldGenerationSizeMb: 64,
maxYoungGenerationSizeMb: 8,
jsDispatchTableSizeMb: 64,
},
});
The two heap caps map onto v8::ResourceConstraints and are applied through a
new `IsolateLimits` struct that Runtime::CreateIsolate takes; the struct is
threaded through the worker startup lambda so CreateIsolate itself stays free
of worker policy. Values are validated at construction: a non-object
`resourceLimits` or a non-numeric key throws a TypeError, a non-finite or
non-positive value throws a RangeError, and unknown keys are ignored.
`jsDispatchTableSizeMb` is a NativeScript extension compiled behind
V8_HAS_JS_DISPATCH_TABLE_RESERVATION_PARAM. Until the prebuilt V8 carries the
reservation parameter, passing it throws; once it does, worker isolates default
to a 64 MB reservation instead of V8's 256 MB, and the main isolate keeps the
default.
Capping a worker's heap is only useful if exhausting it is recoverable, so
every worker isolate now registers a near-heap-limit callback (Node does the
same unconditionally for workers). It forwards "Worker JS heap out of memory"
to the parent's worker.onerror as a plain string payload, asks V8 to terminate
the isolate and returns the limit raised by 16 MB so the in-progress GC can
finish. Termination goes to the isolate the callback belongs to rather than
through Terminate() alone, because Terminate() only reaches an isolate
BackgroundLooper has already published — which happens after the entry script
finishes evaluating, and a worker that exhausts its heap usually does so inside
that entry.
Building the exception detail for a terminating isolate crashed on the empty
v8::Message such an isolate reports, so GetFullMessage now returns the plain JS
message when there is none, and reads the line number with FromMaybe.
0 commit comments