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.
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.
impl Drop for NDArray {
fn drop(&mut self) {
check_call!(ffi::TVMArrayFree(self.as_raw_dltensor()));
}
}
cc @ehsanmok
See https://discuss.tvm.apache.org/t/memory-and-vram-leak-using-rust-frontend/7990
I have found that All
NDArraycreated in rust isNDArray::Borrowed, so they are never freed.If I remove the check, the memory and vram leak won't happend.
cc @ehsanmok