I want to remove the whole numpy array. For instance, if I make array A like
A = np.zeros((2,3))
I want to remove the whole array A and want to reuse the name 'A' in other purpose.
Are there any codes (functions) to delete the array?
I want to remove the whole array A
del A
want to reuse the name 'A' in other purpose.
A = whateverElse # associate A with whateverElse, so simple :o)
A.flags before having done the del A to see more details. Numpy uses smart structures for vector/matrix/tensor data storage & manipulation. Some even do not "own" its own data & are just a lightweight-"reader"-helper into another numpy-object's data, so deleting such non-"owner" will for obvious reasons delete just the lightqweight-"reader"-helper, not the fat-(_foreign by ownership_)-data itself.del doesn't free it, then there's no other way to free this memory than killing the process?
del my_numpy_array_taking_50gb_in_memoryand see what happens in htop then — memory is still allocated