1

I am trying to reduce the memory load of my code. I have a huge dictionary whose value is a numpy.zeros. I have to loop over each key and call a function. Once the iteration ends, the value is no more relevant so I was thinking about deallocating the numpy.zeros.

I tried with the following

for k in dict_temp:
    call_function(dict_temp[k])
    dict_temp[k]=None

But the memory load does not change nor the sys.getsizeof(dict_temp) Is there any way to deallocate the numpy.zeros in the for-loop? Thanks!

GAP
  • 91
  • 4

0 Answers0