12101111 opened a new issue #6559:
URL: https://github.com/apache/incubator-tvm/issues/6559


   See 
https://discuss.tvm.apache.org/t/memory-and-vram-leak-using-rust-frontend/7990
   
   I have found that All `NDArray` created in rust is `NDArray::Borrowed`, so 
they are never freed.
   ```rust
   pub enum NDArray {
       Borrowed { handle: ffi::TVMArrayHandle },
       Owned { handle: *mut c_void },
   }
   
   impl Drop for NDArray {
       fn drop(&mut self) {
           if let &mut NDArray::Owned { .. } = self {
               check_call!(ffi::TVMArrayFree(self.as_raw_dltensor()));
           }
       }
   }
   ```
   
   If I remove the check, the memory and vram leak won't happend.
   
   ```rust
   impl Drop for NDArray {
       fn drop(&mut self) {
           check_call!(ffi::TVMArrayFree(self.as_raw_dltensor()));
       }
   }
   
   ```


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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to