[Numpy-discussion] python eats memory like the cookie monster eats cookies
Sun Feb 4 12:18:00 CST 2007
not sure if I got the right list, but I hope that somebody here will
be able to shed some light on a Python-related memory problem. The
following code eats over >2GB of memory and fails with MemoyError
after just a few iterations.
def ZeroPadData(A, shape):
a = Numeric.zeros(shape, 'w')
for y in xrange(A.shape):
for x in xrange(A.shape):
a[y, x] = A[y, x]
A = Numeric.ones([1998, 3022])
count = 0
a = A
while count < limit:
count += 1
a = ZeroPadData(a, [2048, 4096])
b = fft2(a)
b = ifft2(b)
a = b[:1998,:3022].real
This is for Python 2.4.3 on Mac OS X 10.4.8 (intel) using SciPy 0.5.2.
If anyone could enlighten me about what I am doing wrong, I would very
much appreciate it.
More information about the Numpy-discussion