Skip to content

GC: tree.ts scavenge-on peak RSS (221 MB) still loses to scavenge-off (103 MB) — old-gen churn + young capacity high-water #7438

Description

@proggeramlug

Follow-up to #7432 (adaptive tenuring + young-scoped scavenge cap), which fixed the large-live-set scavenge wall-time regression but leaves one acceptance cell open from gc-handoff/PROMPT-scavenge-large-live-set.md: on tree.ts, scavenge-on must beat PERRY_GC_SCAVENGE=0 on peak RSS as well as wall.

Current state (same binary, arms back-to-back, macOS arm64)

arm wall peak RSS
scavenge ON (#7432) 10.26 s 221 MB
scavenge OFF 10.70 s 103 MB
ON before #7432 48.06 s 172 MB

Max arena in-use across the 43 collections is only ~101 MB; the RSS above that is capacity high-water (mapped-ever pages, mimalloc MADV_FREE retention — heap is Memory Tag 240):

  • Young: up to 64 MB — the influx-driven cap scale legitimately holds ×4 on tree (influx ~3 MB/cycle), and probing showed shrinking it is a bad trade: base=8 MB (eff 32 MB) measured 34 s wall for RSS still ≈220 MB — the young cap is NOT the RSS driver.
  • Old-gen churn: high-water ~70-100 MB in-use under the pre-existing reclaim pacing (GC_OLD_GEN_RECLAIM_THRESHOLD_BYTES = 48 MB, growth 32 MB), cycling 122 MB of promoted-then-dropped tree nodes through old blocks. 37 of tree's 43 collections are already old-reclaim-driven fulls, so the pacing is near its policy floor — lowering the global thresholds trades pause for RSS across every workload and belongs to old-gen policy work, not the tenuring PR.
  • Old-gen fragmentation under scattered survivors compounds this — filed separately (GC: old-gen fragmentation — scattered survivors pin 105 MB of blocks for a ~1 MB live set #7437).

The OFF arm's 103 MB is structurally cheap: the non-moving minor never promotes, so its old-gen is near-empty and its young high-water is one 16 MB cap. Any promoting scavenger pays a young-capacity + old-churn footprint; closing the cell needs old-gen reclaim/defrag to keep ever-touched old capacity near the live set (~35 MB), plus possibly returning young blocks more eagerly after the cap scale shrinks.

Acceptance

tree.ts scavenge-on peak RSS ≤ the PERRY_GC_SCAVENGE=0 arm on the same binary, without giving back #7432's wall win (≤ ~10.5 s) or the churn/cycles RSS results (24 MB / 29 MB).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions