jorisvandenbossche commented on code in PR #313:
URL: https://github.com/apache/arrow-nanoarrow/pull/313#discussion_r1395796208


##########
python/src/nanoarrow/_lib.pyx:
##########
@@ -903,3 +943,112 @@ cdef class ArrayStream:
     def allocate():
         base = ArrayStreamHolder()
         return ArrayStream(base, base._addr())
+
+
+cdef class DeviceArrayHolder:
+    """Memory holder for an ArrowDeviceArray
+
+    This class is responsible for the lifecycle of the ArrowDeviceArray
+    whose memory it is responsible. When this object is deleted,
+    a non-NULL release callback is invoked.
+    """
+    cdef ArrowDeviceArray c_array
+
+    def __cinit__(self):
+        self.c_array.array.release = NULL
+
+    def __dealloc__(self):
+        if self.c_array.array.release != NULL:
+          self.c_array.array.release(&self.c_array.array)
+
+    def _addr(self):
+        return <uintptr_t>&self.c_array
+
+cdef class DeviceHolder:
+    """Memory holder for an ArrowDevice

Review Comment:
   Can you add some docstring then clarifying that? (to the Device class below)



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