Open numpy-gitbot opened 12 years ago
Original ticket http://projects.scipy.org/numpy/ticket/2125 on 2012-05-02 by trac user eschlafly, assigned to unknown.
Under numpy 1.6.0, the following code leaks about a hundred megs of memory for me:
import numpy dtype = [('var1', '100f8')] for i in xrange(100000): arr = numpy.zeros(1, dtype=[('var1_holder', dtype)]) arr['var1_holder'] = numpy.zeros(1, dtype=dtype)[0]
Admittedly, this code should probably trigger some kind of exception anyway. Rewriting the code slightly as below gets rid of the leak:
arr['var1_holder'][0] = numpy.zeros(1, dtype=dtype)
Still, I would much rather have had an exception thrown than a silent memory leak in otherwise well-behaving code.
Original ticket http://projects.scipy.org/numpy/ticket/2125 on 2012-05-02 by trac user eschlafly, assigned to unknown.
Under numpy 1.6.0, the following code leaks about a hundred megs of memory for me:
Admittedly, this code should probably trigger some kind of exception anyway. Rewriting the code slightly as below gets rid of the leak:
Still, I would much rather have had an exception thrown than a silent memory leak in otherwise well-behaving code.