This simple example causes a massive leak in v1.3.0 which didn't exist in
v1.0.1.  What am I doing wrong?  If I replace
arr = [Array((2,2)), Array((2,2))]

with

arr = [numpy.ndarray((2,2,)), numpy.ndarray((2,2))]

then I don't have the leak



import numpy
import gc

 class Array(numpy.ndarray):
def __new__(subtype, shape, dtype=float, buffer=None, offset=0,
strides=None, order=None, info=None):
return numpy.ndarray.__new__(subtype, shape, dtype, buffer, offset, strides,
order)

def __array_finalize__(self, obj):
print 'called array_finalize'

if __name__=='__main__':
arr = [Array((2,2)), Array((2,2))]

nbytesAllocated = 0
 for i in xrange(1000000000):
a = numpy.array(arr)
nbytesAllocated += a.nbytes
 if i%1000 == 0:
print 'allocted %s'%nbytesAllocated
gc.collect()


-- 
--jlm




-- 
--jlm




-- 
--jlm
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to