Commit 0eb02c4
Fix dangling allocator reference in storage deleters (#807)
## Description
This PR resolves intermittent CI failures (specifically row count
mismatches in `rapidsmpf` pipelines) caused by a dangling allocator
reference in `cuco` storage deleters.
### Root Cause
The `custom_deleter` (in `storage_base.cuh`) and `aligned_deleter` (in
`bucket_storage.cuh`) were capturing the `Allocator` by reference
(`Allocator&`). When a container (e.g., `static_multimap`) was moved,
the new container's deleter held a reference to the `allocator_` of the
original, destroyed container.
Subsequent destruction of the new container invoked `deallocate` on a
dangling reference. In asynchronous environments like `rapidsmpf`, this
corruption resulted in "falsely freed" memory being reused by concurrent
CUDA streams, directly causing the observed row count mismatches and
flakiness.
### Changes
- Updated `custom_deleter` and `aligned_deleter` to store the
`Allocator` by **value** instead of by reference.
- Updated constructors to take `Allocator const&` to ensure proper
copying.
- This ensures the allocator's lifetime is correctly tied to the
`unique_ptr` that utilizes it, making all core containers safely
movable.
## Checklist
- [x] I have verified the fix logic with a standalone C++ reproduction
of the move-destruction pattern.
- [x] PR is ready for review.
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>1 parent c4ab17f commit 0eb02c4
2 files changed
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
255 | | - | |
| 255 | + | |
256 | 256 | | |
257 | 257 | | |
258 | | - | |
| 258 | + | |
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
| |||
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
55 | | - | |
| 57 | + | |
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
| |||
0 commit comments