You could try forcing an empty array?
import numpy as np import gc # After clearing your data: data.clear() np.empty((0,)) # forces numpy malloc/free touch gc.collect()