This is an automated email from the ASF dual-hosted git repository.
viirya pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/master by this push:
new 4e0a44d33 Fix memory leak in ffi test (#1878)
4e0a44d33 is described below
commit 4e0a44d334a78d7cf8833fb68b1ebff9a143a365
Author: Liang-Chi Hsieh <[email protected]>
AuthorDate: Tue Jun 14 11:08:28 2022 -0700
Fix memory leak in ffi test (#1878)
* Fix leaks
* Fix leaks under array::ffi::tests
---
arrow/src/array/ffi.rs | 5 +++++
arrow/src/ffi.rs | 2 ++
arrow/src/ffi_stream.rs | 4 ++++
3 files changed, 11 insertions(+)
diff --git a/arrow/src/array/ffi.rs b/arrow/src/array/ffi.rs
index 57329037b..12d6f440b 100644
--- a/arrow/src/array/ffi.rs
+++ b/arrow/src/array/ffi.rs
@@ -74,6 +74,11 @@ mod tests {
let result = &ArrayData::try_from(d1)?;
assert_eq!(result, expected);
+
+ unsafe {
+ Arc::from_raw(array);
+ Arc::from_raw(schema);
+ }
Ok(())
}
diff --git a/arrow/src/ffi.rs b/arrow/src/ffi.rs
index 8eb28837c..84905af20 100644
--- a/arrow/src/ffi.rs
+++ b/arrow/src/ffi.rs
@@ -79,6 +79,8 @@
//! unsafe {
//! Box::from_raw(out_array_ptr);
//! Box::from_raw(out_schema_ptr);
+//! Arc::from_raw(array_ptr);
+//! Arc::from_raw(schema_ptr);
//! }
//!
//! Ok(())
diff --git a/arrow/src/ffi_stream.rs b/arrow/src/ffi_stream.rs
index bfc62b888..c06b52333 100644
--- a/arrow/src/ffi_stream.rs
+++ b/arrow/src/ffi_stream.rs
@@ -500,6 +500,8 @@ mod tests {
}
assert_eq!(produced_batches, vec![batch.clone(), batch]);
+
+ unsafe { Arc::from_raw(stream_ptr) };
Ok(())
}
@@ -529,6 +531,8 @@ mod tests {
}
assert_eq!(produced_batches, vec![batch.clone(), batch]);
+
+ unsafe { Arc::from_raw(stream_ptr) };
Ok(())
}