Skip to content

fix(jsc): preserve generational worker heap collection - #14

Draft
steipete wants to merge 2 commits into
openclaw/release-5718a6ecfrom
fix/worker-gc-cadence-release
Draft

steipete wants to merge 2 commits into
openclaw/release-5718a6ecfrom
fix/worker-gc-cadence-release

Conversation

@steipete

@steipete steipete commented Oct 5, 2026 •

Copy link
Copy Markdown

Worker heap limits currently force the next automatic collection to be full and collapse the whole-heap growth target to the nursery allowance. Repeated maintenance and allocation requests consequently retrace large surviving code graphs instead of using young-generation collection.

Separate full-heap growth from nursery pacing. The revised candidate bounds budgeted workers' post-full target to twice the full heap ledger, retaining the collector minimum and any smaller existing target. This also bounds opportunistic target reuse. The configured nursery cap remains separate; the derived Eden allowance can decrease with the full target. A conservative managed-memory estimate requests full verification when the hard old-generation budget may be exhausted. Only the existing strict post-full survivor check reports OOM, and the checked full-collection buffer snapshot preserves ArrayBuffer exclusion through Eden collections.

Mandatory verification drives its existing collection ticket while idle, even when the optional stop timer is disabled. Both qualification paths include the matching Bun immediate-timer wake adapter. Cached-data semantics, source/referrer identity, debugger behavior and public accounting APIs retain their existing contracts.

The earlier candidate ecf43f247 passed the native stress/module, sampling, ArrayBuffer, stack and cache gates, plus exact-head fork checks. Four-process-per-arm measurements on eight CPUs/four Vitest workers then found providers wall time down 7.4% and CPU down 21.5%, with RSS up 28.4%; messaging wall time regressed 2.4%. Those results do not qualify that version for landing. The new growth ceiling at 32804d651e88b0667cf9831dc8bbe7eb250bc3c1 addresses a measured retention/headroom concern: full-traced heap maxima did not increase in the diagnostics, while surviving SourceProviders did. Logical source ranges are not physical-byte or RSS accounting, so no complete allocation breakdown is claimed.

Current-head status: isolated P2 source review is clean; native build/runtime checks and fresh performance qualification are pending. No current-head speedup or memory improvement is claimed. The existing frozen-candidate matrix continues unchanged to preserve its CPU/worker-shape evidence. The earlier failed real-clock fixture observation remains preserved; its separate deterministic test repair landed in openclaw/openclaw#165661. No GC marker policy is adopted.

Main-line companion #15 remains on the earlier candidate until the revised policy qualifies. Bun timer companion: openclaw/bun#129. This draft does not request artifact publication.

Keep worker nursery pacing separate from the full-heap growth target. Track a conservative managed bound at collection boundaries, preserve the full-only OOM decision, and drive queued verification while a worker is idle.

Add cadence and retained-Eden regression coverage and the matching immediate-timer adapter to both Bun qualification paths.
Keep the post-full allocation target at most twice the current heap ledger,
subject to the existing collector minimum and smaller pressure-driven targets.
Apply the ceiling after opportunistic target reuse and reduce the derived Eden
allowance only when necessary. Preserve the separate configured nursery cap,
checked worker accounting, first-full initialization, strict full-only OOM
predicate, and mandatory verification progress.

This is a bounded follow-up experiment after the initial generational cadence
change reduced CPU but increased retained memory and regressed messaging wall
time. The new growth ceiling has source-only P2 review; native and performance
qualification remain pending.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant