Free Numpy Memory in Place

Viewed 390

Is there any way to get cause numpy to release the memory used by an array? I cannot just run del array as the array is referenced elsewhere.

Example of why this matters and why I think this is safe:

def run():
   arr = np.array(....)
   arr2 = process(arr)
   fit(arr2)

I am able to edit process but not run. Right now arr is holding a lot of memory that is no longer needed after process runs. I would like to delete the contents from arr from within process once I have created arr2.

1 Answers
Related