viirya commented on a change in pull request #1432:
URL: https://github.com/apache/arrow-rs/pull/1432#discussion_r826550474



##########
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:
       When previously we try to get an array data from ffi array and schema, 
we will keep `Arc` pointer of the array in created `Buffer`. That is why we 
don't need to specially take care about when `array` and `schema` are out of 
scope.
   
   But as we move to `Box`, it is not possible now. As we cannot clone ffi 
struct too, we cannot let the `release` is called when the created `Buffer` to 
be deallocated.
   
   




-- 
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]


Reply via email to