While continuing #27 after the catch-binding fix, the PR-249 semantics/oom-one-thread.js witness still fails with a whole-thread/top-level OutOfMemoryError:
FAIL semantics/oom-one-thread.js: OutOfMemoryError: Context heap limit exceededThe previous #27 slice made local catch (e) under Context.Options.heap_limit_bytes work for focused allocation pressure. The remaining witness shape is different: after the hog thread catches/reports OOM and drops its JS references, later allocations must recover. Today the heap cap is enforced by BudgetAllocator at the context allocator layer. In arena-backed mode there is no individual reclamation, and even enabling GC/parallel mid-script collection locally did not make the witness pass; the cap still reaches an unrecoverable OOM path rather than a collect-then-retry/recover path.
Local probes (not committed):
- Enabling GC/parallel_js/parallel_midscript_gc for just
semantics/oom-one-thread.jschanged one run to a raw top-levelerror.OutOfMemorywith no JS exception when stringifying would otherwise print?, and with a higher 320MiB cap still failed as reservedOutOfMemoryError. - This suggests the missing contract is not simple catch binding anymore; it is heap-cap recovery: when a capped GC-backed context hits the cap, the runtime needs a safe collection/retry or emergency-headroom policy before declaring OOM unrecoverable.
Acceptance:
- For GC-backed capped contexts, allocation pressure attempts an appropriate safe collection/retry before surfacing unrecoverable
OutOfMemoryError. - The policy is safe with threads: no collection while unscanned running peers can hold native-stack roots, unless using the abort-safe parallel mid-script protocol.
- Dropping JS references after an OOM lets later allocations succeed once the collector can reclaim unreachable cells/backing stores.
semantics/oom-one-thread.jspasses or progresses to a more specific non-recovery blocker.- Existing focused #27 regressions remain green: optional catch, catch binding, string pressure, and sibling Thread survival.
- Update docs/threads/limits.md and docs/threads/testing.md to distinguish fail-closed arena caps from reclaimable GC-backed capped contexts.