Skip to content

Commit 2e8fce6

Browse files
committed
Enhance drop_stream function to retrieve and free original stream pointer for improved memory management
1 parent 5310988 commit 2e8fce6

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

src/dataframe.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ unsafe extern "C" fn drop_stream(capsule: *mut ffi::PyObject) {
6666
return;
6767
}
6868
let name = ARROW_STREAM_NAME.get_or_init(|| CString::new("arrow_array_stream").unwrap());
69+
// Retrieve the original stream pointer and free it when the capsule drops
6970
let stream_ptr = ffi::PyCapsule_GetPointer(capsule, name.as_ptr()) as *mut FFI_ArrowArrayStream;
7071
if !stream_ptr.is_null() {
7172
drop(Box::from_raw(stream_ptr));

0 commit comments

Comments
 (0)