fix(gc): report live arena bytes after collection (#7879) - #7886
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (12)
📝 WalkthroughWalkthroughHeap accounting now uses header-inclusive live-object censuses for ChangesLive heap accounting
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant GCCollection
participant OldgenSweep
participant ArenaStats
participant GCPacing
GCCollection->>OldgenSweep: sweep and count live arena bytes
OldgenSweep->>ArenaStats: publish arena_live_bytes
GCCollection->>ArenaStats: record post-collection live census
ArenaStats->>GCPacing: provide live allocated arena bytes
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Closes #7879
What changed
process.memoryUsage().heapUsed, compatible V8 telemetry, and both sides of major-GC pacing through the live metric.total_live_allocated_bytesalongsidetotal_in_use_bytes.Reproduction and tests
The regression test applied unchanged to clean
mainreports:A tiny rooted survivor therefore charges the whole partially dead block. With this branch, the focused accounting suite proves:
heapUsed;Validation:
cargo test -p perry-runtime --lib gc::tests::heap_accounting: 3 passedRUST_TEST_THREADS=1 cargo test -p perry-runtime --lib: 2,128 passed, 4 ignoredcargo check -p perry-runtime --features diagnostics: passedQuiet-host A/B
Seven repeats per probe on the locked M1 mini, with fresh 60-second quiet qualification for each arm (5.8% active for base, 4.8% for fix). Both arms used the same compiler and stdlib; only
libperry_runtime.adiffered. All 14 probes passed their Node oracle and produced byte-identical stdout.heapUsedfell by 59.2% to 99.99% across all 14 probes;heapTotalwas unchanged in every probe.12_large_live_set, which promotes a large cohort and then releases most of it: 51,457,736 -> 4,462,040 bytes (-91.3%), with identical GC counters, -0.05% wall, and -0.09% RSS.13_large_eden_survivorsperformed one additional GC step: wall +7.5% (920.6 -> 989.9 ms), RSS -5.9% (205.6 -> 193.4 MB). This is the explicit pacing tradeoff of using live allocation rather than fragmentation as the major-collection signal.The repository ratchet pin is already stale on the clean base. Its
--checkfails current-main cells including the known14_grow_then_churncounter shift; the fix arm leaves those same #14 cells and turns every heap-used comparison into an improvement. No ratchet artifact is changed in this PR.Summary by CodeRabbit
Bug Fixes
heapUsednow excludes reclaimed and reusable memory, whileheapTotalremains unchanged.Diagnostics