Hi, I’m updating my program from pynq v2.6.1 to v2.7. But I have a problem.
I use many CMAs in my design, and I call a clean up function to release the whole CMA at startup like this:
It’s just in case the program crashes and I don’t have time to clean it up. Leaked CMA will cause allocate errors at relaunch.
But now Xlnk is removed in v2.7, PynqBuffer.freebuffer() can release CMA but I don’t have any instance to free at startup.
Can someone kindly help me find a way to release leaked CMA?
But sorry I haven’t found a python function to free buffer. Could you give me an example?
My memory reduced even after del buffer .
I don’t know why and now I have to use the Linux command echo 1 > /proc/sys/vm/drop_caches on the terminal to free buffer , but it’s not useful all the time.
I have no idea what allocate have done to my ram.It becomes confusing when python plus fpga.
inport allocate # replace Xlnk
import gc
weight_buffer = allocate(shape=(25470896,), dtype=np.uint32) # allocate 100M memory
params_w = np.fromfile("yolo.bin", dtype=np.uint32) # read the file
np.copyto(weight_buffer, params_w) # load the file to the 100M memory
del params_w # will not be used again, so delete it to free memory
gc.collect()