tqchen commented on code in PR #17190:
URL: https://github.com/apache/tvm/pull/17190#discussion_r1688288273


##########
python/tvm/_ffi/_cython/object.pxi:
##########
@@ -106,6 +106,10 @@ cdef class ObjectBase:
         def __set__(self, value):
             self._set_handle(value)
 
+        def __del__(self):
+            if self.chandle != NULL:

Review Comment:
   cross check impl of `__dealloc__ ` and see if there will be issue of double 
free



##########
python/tvm/_ffi/_cython/ndarray.pxi:
##########
@@ -72,6 +72,10 @@ cdef class NDArrayBase:
         def __set__(self, value):
             self._set_handle(value)
 
+        def __del__(self):
+            if self.chandle != NULL:
+                CHECK_CALL(TVMFuncFree(self.chandle))

Review Comment:
   cross check impl of `__dealloc__ ` function, this should not be `TVMFuncFree 
`



##########
python/tvm/_ffi/_cython/packed_func.pxi:
##########
@@ -308,15 +308,23 @@ cdef class PackedFuncBase:
         def __set__(self, value):
             self.c_is_global = value
 
+        def __del__(self):
+            self.c_is_global = 0
+
     property handle:
         def __get__(self):
             if self.chandle == NULL:
                 return None
             else:
                 return ctypes.cast(<unsigned long long>self.chandle, 
ctypes.c_void_p)
+
         def __set__(self, value):
             self._set_handle(value)
 
+        def __del__(self):
+            if self.chandle != NULL:

Review Comment:
   cross check impl of dealloc function



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