Commit b790763
authored
refactor: centralizing shared-allocation accounting for Arc DFHeapSize impls (#23349)
## Which issue does this PR close?
- Closes #22867
## 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 `Arc` allocation identity and deduplication, namely
for providing pointer extraction & `DFHeapSizeCtx` set membership
checks, with the `DFHeapSize` implementations on `Arc` backed types
using the new helpers
## Are these changes tested?
Yes, the below are passing:
```
cargo test -p datafusion-common heap_size --lib
cargo test -p datafusion-common --doc heap_size
```
## Are there any user-facing changes?
No1 parent 4ca85d2 commit b790763
1 file changed
Lines changed: 22 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
79 | 85 | | |
80 | 86 | | |
81 | 87 | | |
| |||
281 | 287 | | |
282 | 288 | | |
283 | 289 | | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
284 | 300 | | |
285 | 301 | | |
286 | | - | |
| 302 | + | |
287 | 303 | | |
288 | | - | |
| 304 | + | |
289 | 305 | | |
290 | 306 | | |
291 | 307 | | |
| |||
296 | 312 | | |
297 | 313 | | |
298 | 314 | | |
299 | | - | |
| 315 | + | |
300 | 316 | | |
301 | | - | |
| 317 | + | |
302 | 318 | | |
303 | 319 | | |
304 | 320 | | |
| |||
309 | 325 | | |
310 | 326 | | |
311 | 327 | | |
312 | | - | |
| 328 | + | |
313 | 329 | | |
314 | | - | |
| 330 | + | |
315 | 331 | | |
316 | 332 | | |
317 | 333 | | |
| |||
0 commit comments