From: Todd M. <jm...@st...> - 2006-08-11 21:13:42
|
Francesc Altet wrote: > Hi, > > I was tracking down a memory leak in PyTables and it boiled down to a problem > in the array protocol. The issue is easily exposed by: > > for i in range(1000000): > numarray.array(numpy.zeros(dtype=numpy.float64, shape=3)) > > and looking at the memory consumption of the process. The same happens with: > > for i in range(1000000): > numarray.asarray(numpy.zeros(dtype=numpy.float64, shape=3)) > > However, the numpy<--numarray sense seems to work well. > > for i in range(1000000): > numpy.array(numarray.zeros(type="Float64", shape=3)) > > Using numarray 1.5.1 and numpy 1.0b1 > > I think this is a relatively important problem, because it somewhat prevents a > smooth transition from numarray to NumPy. > > Thanks, > > I looked at this a little with a debug python and figure it's a bug in numpy.zeros(): >>> numpy.zeros(dtype=numpy.float64, shape=3) array([ 0., 0., 0.]) [147752 refs] >>> numpy.zeros(dtype=numpy.float64, shape=3) array([ 0., 0., 0.]) [147753 refs] >>> numpy.zeros(dtype=numpy.float64, shape=3) array([ 0., 0., 0.]) [147754 refs] >>> numarray.array([1,2,3,4]) array([1, 2, 3, 4]) [147772 refs] >>> numarray.array([1,2,3,4]) array([1, 2, 3, 4]) [147772 refs] >>> numarray.array([1,2,3,4]) array([1, 2, 3, 4]) [147772 refs] Regards, Todd |