Repository navigation
Fix leaked host objects from moving out of unique_ptr::release() - #25003
Conversation
Several places called release() on a std::unique_ptr and then moved from the raw pointer it returned, e.g. std::move(*ptr.release()) or ptr.release()[0]. The device memory was moved out and freed normally, but nothing deleted the small host-side object (rmm::device_buffer, cuda::device_buffer, or cudf::column), so each call leaked it. Move from *ptr instead so the unique_ptr keeps ownership and deletes the moved-from object. This fixes the sites listed in NVIDIA#24926 plus the same pattern in groupby argmin/argmax, the IO column_buffer, the JNI list-overlap code, and the benchmark data generators. Also add a note about this pattern to cpp/REVIEW_GUIDELINES.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
/ok to test |
|
@coderabbitai full review |
Action performed
|
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
|
/merge |
Description
Several places in libcudf called
release()on astd::unique_ptrand then moved from the raw pointer it returned (std::move(*ptr.release()),ptr.release()[0], orauto p = contents.data.release();). The device memory was moved out and freed normally, but nothing deleted the small host-side object (rmm::device_buffer,cuda::device_buffer<bitmask_type>, orcudf::column), so each call leaked it.This PR moves from
*ptrinstead, so theunique_ptrkeeps ownership and deletes the moved-from object.It fixes all the sites listed in #24926, plus the same pattern found in:
cpp/src/groupby/sort/group_argmin.cu,group_argmax.cucpp/src/io/utilities/column_buffer.cppjava/src/main/native/src/ColumnViewJni.cucpp/benchmarks/common/generate_input.cu(5 sites),cpp/benchmarks/io/text/multibyte_split.cppIt also adds a one-line note about this pattern to the Resource Management section of
cpp/REVIEW_GUIDELINES.md, so future reviews catch it.The remaining
unique_ptr::release()calls in the tree hand ownership off on purpose: the JNIContiguousTableJni.cpp, DLPack/Arrow interop, and custom deleters.Closes #24926
Checklist
🤖 Generated with Claude Code