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

Jose Borreguero borreguero at gmail.com
Fri Oct 24 14:39:59 EDT 2008


My bad. Using the intermediate list does *not* leak.
Still, the original problems stays. Can anyone run the following code in
their machine and see if they have leaks?
Maybe it only happens to me :(*

import numpy,Numeric
big=10000000
na=numpy.array([0.0,])
for i in range(big):
    Na=Numeric.array(na,Numeric.Float)*

-Jose

On Fri, Oct 24, 2008 at 2:16 PM, Jose Borreguero <borreguero at gmail.com>wrote:

> 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
>



-- 
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/b0087aa2/attachment.html>


More information about the NumPy-Discussion mailing list