jhorstmann commented on a change in pull request #1494:
URL: https://github.com/apache/arrow-rs/pull/1494#discussion_r837853899



##########
File path: arrow/src/alloc/mod.rs
##########
@@ -121,3 +124,30 @@ pub unsafe fn reallocate<T: NativeType>(
         handle_alloc_error(Layout::from_size_align_unchecked(new_size, 
ALIGNMENT))
     })
 }
+
+/// The owner of an allocation, that is not natively allocated.
+/// The trait implementation is responsible for dropping the allocations once 
no more references exist.
+pub trait Allocation: RefUnwindSafe {}
+
+impl<T: RefUnwindSafe> Allocation for T {}
+
+/// Mode of deallocating memory regions
+pub enum Deallocation {
+    /// Native deallocation, using Rust deallocator with Arrow-specific memory 
alignment
+    Native(usize),
+    /// Foreign interface, via a callback
+    Foreign(Arc<dyn Allocation>),
+}
+
+impl Debug for Deallocation {
+    fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
+        match self {
+            Deallocation::Native(capacity) => {

Review comment:
       I think the comment on `Native(usize)` means that the memory was 
allocated using arrow's allocator, which uses a specific alignment depending on 
platform. I'll update the comment to make that clearer.




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