@@ -178,6 +178,8 @@ const gc = @import("gc");
178178var rt = MyRuntime{}; // holds your roots + finalizer state
179179var heap = gc.Heap(MyRuntime).init(allocator, &rt);
180180defer heap.deinit(); // frees + finalizes everything left
181+ heap.setNurseryTenuringAge(3); // retain survivors for three minor cycles
182+ heap.setNurseryEnabled(true);
181183
182184const obj = try heap.create(MyObject, .object); // uninitialized payload
183185obj.* = .{ ... }; // initialize before the next safepoint
@@ -189,7 +191,7 @@ for (objects[0..count]) |item| item.* = .{ ... }; // initialize before a safepoi
189191heap.maybeCollect(); // call at safepoints; collects past a threshold
190192heap.collect(); // or force a full stop-the-world cycle
191193const compacted = heap.collectAndCompact(); // opt-in binding: collect + relocate
192- const stats = heap.accounting(); // race-safe live/last-full byte snapshot
194+ const stats = heap.accounting(); // race-safe generation + heap telemetry
193195```
194196
195197` create ` and ` createBatch ` return uninitialized payloads — initialize them
@@ -202,18 +204,21 @@ batch reports its successfully published prefix so the caller can commit that
202204work before the next allocation performs recovery or reports OOM, preserving
203205sequential failure ordering.
204206
205- ` accounting() ` snapshots live cell/byte totals, collection counts, and the
206- post-sweep byte size of the last completed full collection. Parallel and
207- concurrent-metadata heaps take the collector's allocation lock for the snapshot;
208- nursery-only cycles deliberately leave ` last_full_collection_bytes ` unchanged.
207+ ` accounting() ` snapshots live/young/promoted totals, collection counts, the
208+ configured tenuring age, the latest minor survivor/reclamation/promotion bytes,
209+ and the post-sweep byte size of the last full collection. Old-container and
210+ conservative-target cards persist while survivors remain young, so an unchanged
211+ old-to-young edge stays sound across repeated minors. Full collection or nursery
212+ disable explicitly tenures the remaining young prefix.
209213
210214## Status
211215
212216The collector supports stop-the-world, incremental, concurrent, parallel, and
213- one-cycle nursery paths, plus opt-in stop-the-world relocation. The default
214- remains non-moving. Unit and TSan gates cover cycles, weak/finalization
215- semantics, allocation/publication races, relocation rollback, pinned/moved
216- graphs, and exact accounting.
217+ configurable multi-age nursery paths, plus opt-in stop-the-world relocation. The
218+ default remains non-moving with one-cycle tenuring until an embedder selects a
219+ higher age. Unit and TSan gates cover cycles, weak/finalization semantics,
220+ allocation/publication races, relocation rollback, pinned/moved graphs, and
221+ exact accounting.
217222
218223## License
219224
0 commit comments