S
sonjaa
Hi
last week I posted a problem with running out of memory when changing
values in NumPy arrays. Since then I have tried many different
approaches and
work-arounds but to no avail.
I was able to reduce the code (see below) to its smallest size and
still
have the problem, albeit at a slower rate. The problem appears to come
from changing values in the array. Does this create another reference
to the
array, which can't be released?
Also, are there other python methods/extensions that can create
multi-deminsional
arrays?
thanks again to those who repsonded to the last post
Sonja
PS. to watch the memory usage I just used task manager
the code:
from numpy import *
y = ones((501,501))
z = zeros((501,501))
it = 50
for kk in xrange(it):
y[1,1] = 4
y[1,2] = 4
y[1,0] = 4
y[2,1] = 6
print "Iteration #:%s" %(kk)
for ee in xrange(0,501):
for ff in xrange(0,501):
if y[ee,ff] == 4 or y[ee,ff] == 6:
y[ee,ff] = 2
else:
pass
last week I posted a problem with running out of memory when changing
values in NumPy arrays. Since then I have tried many different
approaches and
work-arounds but to no avail.
I was able to reduce the code (see below) to its smallest size and
still
have the problem, albeit at a slower rate. The problem appears to come
from changing values in the array. Does this create another reference
to the
array, which can't be released?
Also, are there other python methods/extensions that can create
multi-deminsional
arrays?
thanks again to those who repsonded to the last post
Sonja
PS. to watch the memory usage I just used task manager
the code:
from numpy import *
y = ones((501,501))
z = zeros((501,501))
it = 50
for kk in xrange(it):
y[1,1] = 4
y[1,2] = 4
y[1,0] = 4
y[2,1] = 6
print "Iteration #:%s" %(kk)
for ee in xrange(0,501):
for ff in xrange(0,501):
if y[ee,ff] == 4 or y[ee,ff] == 6:
y[ee,ff] = 2
else:
pass