Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"del buffer" dosen't work #19

Open
qing-2 opened this issue Mar 22, 2022 · 1 comment
Open

"del buffer" dosen't work #19

qing-2 opened this issue Mar 22, 2022 · 1 comment

Comments

@qing-2
Copy link

qing-2 commented Mar 22, 2022

I run Session_4/4_basic_allocate_example.ipynb on my jupyter notebook.
The 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 cache, but it's not useful all the time.
I have no idea what allocate have done to my ram.

@qing-2
Copy link
Author

qing-2 commented Mar 26, 2022

after adding gc , del works !!! ✌

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()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant