refactor: centralizing shared-allocation accounting for Arc DFHeapSize impls#23349
refactor: centralizing shared-allocation accounting for Arc DFHeapSize impls#23349saadtajwar wants to merge 4 commits into
Conversation
|
cc @kosiew - thanks in advance for any feedback! :) |
mkleen
left a comment
There was a problem hiding this comment.
@saadtajwar Thanks for working on this! I left a comment.
kosiew
left a comment
There was a problem hiding this comment.
Nice cleanup overall. I don't see any correctness issues, and consolidating the shared Arc accounting logic makes this easier to maintain. I just have one small suggestion that could help document an important invariant.
|
Thank you! Any further steps to get this in? Should I tag a repo maintainer? 👀 |
No, the pr usually sits for a few more days so other people can have a look and will be eventually merged. |
Ah okay sounds good, thanks! |
Which issue does this PR close?
Rationale for this change
DFHeapSize depends on a critical invariant: shared heap allocations must be counted once per traversal context. If Arc implementations drift, memory accounting becomes inconsistent and hard to reason about.
Consolidating the one-time-accounting logic improves:
Correctness durability (single source of truth for Arc dedup behavior)
Maintainability (less repeated logic)
Reviewability (future changes touch one helper)
What changes are included in this PR?
Helper functions for
Arcallocation identity and deduplication, namely for providing pointer extraction &DFHeapSizeCtxset membership checks, with theDFHeapSizeimplementations onArcbacked types using the new helpersAre these changes tested?
Yes, the below are passing:
Are there any user-facing changes?
No