-
Notifications
You must be signed in to change notification settings - Fork 850
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix pyarrow memory leak (#3683) #3893
Conversation
d2b50c4
to
8573b38
Compare
Remove ArrowArray::into_raw and try_from_raw
8573b38
to
9028daa
Compare
@@ -118,9 +118,6 @@ struct ArrayPrivateData { | |||
|
|||
impl FFI_ArrowArray { | |||
/// creates a new `FFI_ArrowArray` from existing data. | |||
/// # Memory Leaks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is out-of-date, FFI_ArrowArray
frees memory automatically on drop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that it means that consumer of FFI_ArrowArray
(might be in other language like JVM) should call release
as C Data Interface defines to release it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps, but from the context of Rust it is just a little bit confusing, as release
isn't even publicly visible 😅
@@ -66,6 +51,7 @@ pub unsafe fn make_array_from_raw( | |||
/// This function copies the content of two FFI structs [ffi::FFI_ArrowArray] and | |||
/// [ffi::FFI_ArrowSchema] in the array to the location pointed by the raw pointers. | |||
/// Usually the raw pointers are provided by the array data consumer. | |||
#[deprecated(note = "Use FFI_ArrowArray::new and FFI_ArrowSchema::try_from")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above methods are not only safe, but less likely to accidentally leak memory
* Fix pyarrow memory leak (apache#3683) Remove ArrowArray::into_raw and try_from_raw * Update docs * Further deprecation * Clippy
Which issue does this PR close?
Closes #3683
Rationale for this change
This is a follow on to #3685 that removes the deprecated methods, and fixes a remaining memory leak.
What changes are included in this PR?
Are there any user-facing changes?