memory usage of the jupyter notebook peaks out until there’s an error

Based on this question, the python garbage collector won’t automatically free up unreferenced memory immediately. It might depend on your use case, but for me, using import gc and gc.collect() in certain points, to manually command the garbage collector to clean up the data, worked well. So my current program looks kind of like this:

while True:
   ls = make_list_to_mem_thresh()
   use_list(ls)
   del ls
   gc.collect()

It’s likely that, when a cell fails, it triggers the garbage collector. If that is the case, that would explain the “capping” phenomenon described in the question.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top