Repository navigation
Description
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 exceeded
The 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 Runtime: make heap-limit allocation failures catchable at JS allocation sites #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.
Activity
chrisbbreuer commentedon Jul 11, 2026
Pushed b557f38 (test threads: run heap-limit probes with gc) as a #29 setup and probe-realism slice.
What changed:
Focused validation:
The PR-249 witness still fails with the same expected evidence: FAIL semantics/oom-one-thread.js: OutOfMemoryError: Context heap limit exceeded.
So the remaining blocker is now sharper: even in a GC-backed capped context, the runtime still needs a safe collect/retry or emergency-headroom path while the allocating Threads are active. This change does not close #29; it makes the probe test the intended class of failure.
chrisbbreuer commentedon Jul 11, 2026
Resolved the PR-249 heap-cap recovery blocker with zig-gc b99de49 and zig-js 78b553a.
What landed:
Validation:
Follow-up for the remaining broader perfection work is #30: no-GIL emergency recovery and side-store/ArrayBuffer-byte retry policy. Closing this issue because the GC-backed capped-context recovery target and the PR-249 witness are now handled.
fix(intl): Segmenter grapheme rules for CRLF and regional indicators
fix(intl): Segmenter keeps mid-word apostrophes and letter dots/colons
fix(intl): Segmenter splits punctuation into individual word segments
fix(intl): Segmenter breaks words at alphabetic↔CJK script boundaries
fix(intl): Segmenter sentence boundaries (newline + terminator rules)
feat(intl): full UAX #29 grapheme segmentation (UCD-driven)
test(regexp): pin zig-regex#28 and #29 through zig-js, and move CI to…