[Numpy-discussion] Memory leak in ndarray

2007-10-26 Thread Robert Crida
Hi all I seem to have tracked down a memory leak in the string conversion mechanism of numpy. It is demonstrated using the following code: import numpy as np a = np.array([1.0, 2.0, 3.0]) while True: b = str(a) What happens above is that is repeatedly converted to a string. The process size

Re: [Numpy-discussion] Memory leak in ndarray

2007-10-26 Thread Matthew Brett
Hi, > I seem to have tracked down a memory leak in the string conversion mechanism > of numpy. It is demonstrated using the following code: > > import numpy as np > > a = np.array([1.0, 2.0, 3.0]) > while True: > b = str(a) Would you not expect python rather than numpy to be dealing with the

Re: [Numpy-discussion] Memory leak in ndarray

2007-10-26 Thread David Cournapeau
Robert Crida wrote: > Hi all > > I seem to have tracked down a memory leak in the string conversion > mechanism of numpy. It is demonstrated using the following code: > > import numpy as np > > a = np.array([1.0, 2.0, 3.0]) > while True: > b = str(a) > > What happens above is that is repeatedl

Re: [Numpy-discussion] Memory leak in ndarray

2007-10-26 Thread Robert Crida
Hi I don't think it is a python issue because if you change the line b = str(a) to just read str(a) then the problem still occurs. Also, if you change a to be a list instead of ndarray then the problem does not occur. Cheers Robert On 10/26/07, Matthew Brett <[EMAIL PROTECTED]> wrote: > > Hi,

Re: [Numpy-discussion] Memory leak in ndarray

2007-10-26 Thread David Cournapeau
Robert Crida wrote: > Hi > > I don't think it is a python issue because if you change the line b = > str(a) to just read > str(a) > then the problem still occurs. > > Also, if you change a to be a list instead of ndarray then the problem > does not occur. How do you know there is a memory leak ?

Re: [Numpy-discussion] Memory leak in ndarray

2007-10-26 Thread David Cournapeau
On 10/26/07, Robert Crida <[EMAIL PROTECTED]> wrote: > Hi again > > I watch the VmSize of the process using eg top or ps > > If a is a list then it remains constant. If a is an ndarray as shown in the > example, then the VmSize grows quite rapidly. > Actually, I did a typo while copying your exampl

Re: [Numpy-discussion] Memory leak in ndarray

2007-10-26 Thread David Cournapeau
On 10/26/07, David Cournapeau <[EMAIL PROTECTED]> wrote: > On 10/26/07, Robert Crida <[EMAIL PROTECTED]> wrote: > > Hi again > > > > I watch the VmSize of the process using eg top or ps > > > > If a is a list then it remains constant. If a is an ndarray as shown in the > > example, then the VmSize

Re: [Numpy-discussion] Memory leak in ndarray

2007-10-26 Thread Robert Crida
Hi again I watch the VmSize of the process using eg top or ps If a is a list then it remains constant. If a is an ndarray as shown in the example, then the VmSize grows quite rapidly. Cheers Robert On 10/26/07, David Cournapeau <[EMAIL PROTECTED]> wrote: > > Robert Crida wrote: > > Hi > > > > I

Re: [Numpy-discussion] Memory leak in ndarray

2007-10-26 Thread Robin
I can confirm the same behaviour with numpy '1.0.4.dev4271' on OS X 10.4with python 2.5.1 (installer from python.org). For me the memory used by the python process grows at about 1MB/sec. The memory isn't released when the loop is canceled. ___ Numpy-dis

[Numpy-discussion] Memory leak in ndarray, more info

2007-10-26 Thread Robert Crida
Hi all I recently posted about a memory leak in numpy and failed to mention the version. The leak manifests itself in numpy-1.0.3.1 but is not present in numpy-1.0.2 The following code reproduces the bug: import numpy as np a = np.array([1.0, 2.0, 3.0]) while True: b = str(a) What happens

Re: [Numpy-discussion] Memory leak in ndarray, more info

2007-10-26 Thread Matthieu Brucher
Which version Python are you using ? Matthieu 2007/10/26, Robert Crida <[EMAIL PROTECTED]>: > > Hi all > > I recently posted about a memory leak in numpy and failed to mention the > version. The leak manifests itself in numpy-1.0.3.1 but is not present in > numpy-1.0.2 > > The following code repr

Re: [Numpy-discussion] Memory leak in ndarray, more info

2007-10-26 Thread Kurt Smith
On 10/26/07, Robert Crida <[EMAIL PROTECTED]> wrote: > Hi all > > I recently posted about a memory leak in numpy and failed to mention the > version. The leak manifests itself in numpy-1.0.3.1 but is not present in > numpy-1.0.2 > > The following code reproduces the bug: > > import numpy as np > >

Re: [Numpy-discussion] Memory leak in ndarray, more info

2007-10-27 Thread Karol Langner
On Friday 26 October 2007 05:39, Robert Crida wrote: > Hi all > > I recently posted about a memory leak in numpy and failed to mention the > version. The leak manifests itself in numpy-1.0.3.1 but is not present in > numpy-1.0.2 > > The following code reproduces the bug: > > import numpy as np > >

Re: [Numpy-discussion] Memory leak in ndarray, more info

2007-10-28 Thread Karol Langner
On Friday 26 October 2007 05:39, Robert Crida wrote: > I recently posted about a memory leak in numpy and failed to mention the > version. The leak manifests itself in numpy-1.0.3.1 but is not present in > numpy-1.0.2 > > The following code reproduces the bug: > > import numpy as np > > a = np.arra

Re: [Numpy-discussion] Memory leak in ndarray, more info

2007-10-28 Thread Karol Langner
I opened a ticket for this (#602). Hopefully someone will confirm that adding that Py_DECREF call fixes the leak and someone with write access patches it in svn. - Karol -- written by Karol Langner Sun Oct 28 23:29:18 EDT 2007 ___ Numpy-discussion ma

Re: [Numpy-discussion] Memory leak in ndarray, more info

2007-10-28 Thread Travis E. Oliphant
Karol Langner wrote: > I opened a ticket for this (#602). Hopefully someone will confirm that adding > that Py_DECREF call fixes the leak and someone with write access patches it > in svn. > Thanks for looking into this and isolating the problem... -Travis O. __

Re: [Numpy-discussion] Memory leak in ndarray, more info

2007-10-28 Thread Robert Crida
Hi Karol Thank you very much for the sleuth work here. We are in the midst of software ATP so it helps a lot that I will be able to resolve this bug properly. Robert On 10/29/07, Karol Langner <[EMAIL PROTECTED]> wrote: > > I opened a ticket for this (#602). Hopefully someone will confirm that >