viirya commented on a change in pull request #1432:
URL: https://github.com/apache/arrow-rs/pull/1432#discussion_r826611252
##########
File path: arrow/src/array/array.rs
##########
@@ -629,7 +629,9 @@ pub unsafe fn make_array_from_raw(
schema: *const ffi::FFI_ArrowSchema,
) -> Result<ArrayRef> {
let array = ffi::ArrowArray::try_from_raw(array, schema)?;
- let data = ArrayData::try_from(array)?;
+ let data = ArrayData::try_from(&array)?;
+ // Avoid dropping the `Box` pointers and trigger the `release` mechanism.
+ let _ = ffi::ArrowArray::into_raw(array);
Review comment:
Previously you don't need it. As `Arc` is kept in the created Buffer of
Array data, you can rely on deallocation of the Buffer to call `release` of
such ffi structs.
But `Box` cannot give us such benefit. So it makes the management more
explicit and relying on users. We need to keep these structs so `release` won't
be called, before we don't need the Array data (Buffer).
The code is at `ArrowArrayRef.to_data`. It is to create an `ArrayData` from
an `ArrowArray(Ref)`. And you can follow `buffers` -> `create_buffer` ->
`Buffer::from_unowned`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]