Open 3togo opened 1 year ago
The revised version will still fail. How to avoid memory accumulation?
use arrayfire::*;
// use std::mem;
fn main() {
let device = get_device();
for i in 0..1000 {
let x = load_image::<u8>("2dzs/robot_2dz.png".to_string(), true);
x.eval();
// mem::forget(x);
drop(x);
sync(device);
println!("i={}", i);
}
}
use load_image_native instead of load_image could avoid the problem
Actually load_image_native will still cause memory accumulation but much slower than that of load_image.
How to free the accumulated memory to avoid the program crashing?
The following program crashed. But why?