FA-90503 / Garbage collector invariants / Member archive
Heap pacing: percentage change based on current live bytes · case 03
Changing the percentage mid-cycle uses a live size the collector has not measured.
Case contract
GOGC-style pacing starting at 100 percent with goal = min_heap. alloc b adds b to the heap and to live bytes and triggers a collection when collection is enabled (percentage >= 0) and heap >= goal: the heap shrinks to the live bytes, which become the marked size, and goal = max(marked + marked * pct // 100, min_heap). drop b turns b live bytes into garbage. setgc p changes the percentage (-1 disables) and, unless disabled, recomputes the goal from the last marked size. Return the heap sizes at which collections triggered, the final goal and heap.
Why this case matters
Collector pacing decides when collections run; off-by-one or base errors change memory footprint.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| goal recomputed from last marked heap | {"gcs": [260, 660], "goal": 1590, "heap": 660} | {"gcs": [260, 790], "goal": 1980, "heap": 660} | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗