[Numpy-discussion] creating a Numeric array from a numpy array LEAKS memory

Jose Borreguero borreguero at gmail.com
Fri Oct 24 14:16:03 EDT 2008


numpy 1.1.0 (from /usr/lib/python2.4/site-packages/numpy/version.py)
Numeric 24.2 (from
/usr/lib/python2.4/site-packages/Numeric/numeric_version.py)

I also tried with an intermediate list, but got the same result:
*mylist=list(my_numpy_array)
na=Numeric.array( mylist, Numeric.Float)*
I don't have memory leaks if I use something like:
*mylist=[0.0]*BIGNUMBER*
*na=Numeric.array( mylist, Numeric.Float)*

-Jose

On Fri, Oct 24, 2008 at 1:54 PM, Travis E. Oliphant
<oliphant at enthought.com>wrote:

> Jose Borreguero wrote:
> > Dear numpy users,
> >
> > I need to pass a Numeric array to some oldie code from a numpy array.
> > I decided to go like this:
> >
> > for i in range(BIGNUMER):
> >     my_numpy_array=grabArray(i)
> >     na=Numeric.array( my_numpy_array, Numeric.Float)
> >     oldie_code(na)
> >
> > The constructor line:
> > na=Numeric.array( my_numpy_array, Numeric.Float)
> > does leak memory.
> >
> > Is there a way to pass the Numeric array to oldie_code without the leaks?
> This should work without memory leaks, but there may be a bug in NumPy
> or Numeric.
>
> Which version of Numeric and NumPy do you have?
>
> -Travis
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>



-- 
Jose M. Borreguero
Postdoctoral Associate
Oak Ridge National Laboratory
P.O. Box 2008, M.S. 6164
Oak Ridge, TN 37831
phone: 865-241-3071 fax: 865-576-5491
Email: borreguerojm at ornl.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20081024/2f06e6c7/attachment.html>


More information about the NumPy-Discussion mailing list