-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Closed
Labels
rustRelated to TVM's Rust bindingsRelated to TVM's Rust bindings
Description
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
Metadata
Metadata
Assignees
Labels
rustRelated to TVM's Rust bindingsRelated to TVM's Rust bindings