feat(track-memory-allocations): track deallocations, peak heap growth, arena growth, and all-arena totals#24550
feat(track-memory-allocations): track deallocations, peak heap growth, arena growth, and all-arena totals#24550Boshen wants to merge 1 commit into
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
472f06f to
9e4f596
Compare
Merging this PR will not alter performance
Comparing Footnotes
|
69068b0 to
6573f83
Compare
9e4f596 to
6b3deac
Compare
6b3deac to
80f0091
Compare
906b58c to
f83d4e0
Compare
80f0091 to
9379170
Compare
f83d4e0 to
073e5a0
Compare
…, arena growth, and all-arena totals Adds six values to each per-file block in the allocation snapshots: - `sys deallocs` / `sys dealloc bytes`: deallocations made via the system allocator, excluding arena chunk deallocations (mirroring the alloc-side chunk exclusion). Each `realloc` counts its old size as freed, so `sys alloc bytes - sys dealloc bytes` is the net bytes a stage retains. Distinguishes churn (allocated and freed within the stage) from retained memory. - `peak heap growth`: the largest rise of live system-allocator bytes above the stage's starting level, at any moment during the stage. Catches transient balloons that cumulative counters cannot see. Arena chunks are included — this is a footprint number — so values move in chunk-sized steps when transient arenas are created. - `total arena allocs` / `total arena reallocs`: allocations in ALL arenas, tracked by global counters. Short-lived arenas dropped inside a stage (e.g. the arena backing oxc_semantic's Scoping) were previously invisible: the semantic stage showed `arena allocs: 0` while building a whole arena. - `arena growth`: used-bytes delta of the measured Allocator's arena, attributing arena consumption to the stage that caused it (the existing `arena size` gauge is cumulative across stages). oxc_allocator's tracking (feature-gated) now records chunk deallocation count/bytes and global all-arena alloc/realloc counts. Byte-value lines follow the established policy: snapshots record Linux x64 (CI) values; counts are identical on all platforms. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
9379170 to
7cead98
Compare

Stacked on #24543. Adds six values to each per-file block, extending the snapshots with deallocation, footprint, and attribution metrics:
sys deallocs/sys dealloc bytes— deallocations via the system allocator, with arena chunk deallocations excluded (mirroring the alloc-side exclusion). Eachrealloccounts its old size as freed, sosys alloc bytes − sys dealloc bytesis the net bytes a stage retains. The semantic block above shows its value: semantic's 3.87 MB of SoA tables are pure churn — allocated and fully freed within the stage.peak heap growth— the largest rise of live heap bytes above the stage's starting level at any moment during the stage. Catches transient balloons the cumulative counters can't see (semantic's true transient footprint is 7.54 MB, previously invisible). Arena chunks are included here — it's a footprint number — so values move in chunk-sized steps when transient arenas are created.total arena allocs/total arena reallocs— allocations in ALL arenas via new global counters. Fixes a blind spot: short-lived arenas dropped inside a stage (e.g. the arena backing semantic'sScoping) had per-arena stats that died with them — the semantic stage claimedarena allocs: 0while building an entire arena (actual: 37851).arena growth— used-bytes delta of the measuredAllocator, attributing arena consumption to the stage that caused it; the existingarena sizegauge stays as the cumulative view (parser: growth == size, built from empty).oxc_allocator's feature-gated tracking now also records chunk deallocation count/bytes (global_chunk_deallocation_stats) and global all-arena alloc/realloc counts (global_arena_allocation_stats).Byte-value lines follow the established policy from #24543: snapshots record Linux x64 (CI) values. All count lines — including the new
sys deallocsandtotal arenalines — are expected to be platform-identical.🤖 Generated with Claude Code