[NumPy-Tickets] [NumPy] #1548: matrix unbounded memory leak using +=
NumPy Trac
numpy-tickets@scipy....
Thu Jul 15 23:43:26 CDT 2010
#1548: matrix unbounded memory leak using +=
--------------------------------+-------------------------------------------
Reporter: cardinal | Owner: somebody
Type: defect | Status: new
Priority: high | Milestone: Unscheduled
Component: numpy.core | Version: 1.2.1
Keywords: matrix memory leak |
--------------------------------+-------------------------------------------
The following code (and many variants) leaks memory unboundedly:
{{{
from numpy import *
niter = 2000000
X = matrix(zeros(4), float).reshape(2,2)
for iter in range(niter):
X += X
}}}
Replacing "X += X" with "X = X + X" solves the problem.
Things like "X += a" where a is a scalar cause the same problem and have
the same fix.
This occurs in Python 2.5.1 (r251:54863, Jan 26 2008, 16:54:44) with numpy
1.0.4 on a Linux box and Python 2.6.1 (r261:67515, Dec 17 2009, 00:59:15)
on Mac OS X laptop with numpy 1.2.1.
--
Ticket URL: <http://projects.scipy.org/numpy/ticket/1548>
NumPy <http://projects.scipy.org/numpy>
My example project
More information about the NumPy-Tickets
mailing list