Re: [Numpy-discussion] Solving a memory leak in a numpy extension; PyArray_ContiguousFromObject

2009-04-20 Thread Dan S
Thanks all for responses. Continuation below: 2009/4/18 Charles R Harris charlesr.har...@gmail.com: On Fri, Apr 17, 2009 at 9:25 AM, Dan S dan.s.towell+nu...@gmail.com wrote: Hi - I have written a numpy extension which works fine but has a memory leak. It takes a single array argument and

Re: [Numpy-discussion] Solving a memory leak in a numpy extension; PyArray_ContiguousFromObject

2009-04-20 Thread V. Armando Solé
Dan S wrote: But as you can see, my C code doesn't perform any malloc() or suchlike, so I'm stumped. I'd be grateful for any further thoughts Could it be your memory leak is in: return PyFloat_FromDouble(3.1415927); // temporary You are creating a python float object from something. What if

Re: [Numpy-discussion] Solving a memory leak in a numpy extension; PyArray_ContiguousFromObject

2009-04-20 Thread Dan S
2009/4/20 V. Armando Solé s...@esrf.fr: Dan S wrote: But as you can see, my C code doesn't perform any malloc() or suchlike, so I'm stumped. I'd be grateful for any further thoughts Could it be your memory leak is in: return PyFloat_FromDouble(3.1415927); // temporary You are creating a

Re: [Numpy-discussion] Solving a memory leak in a numpy extension; PyArray_ContiguousFromObject

2009-04-18 Thread David Cournapeau
Dan S wrote: Hi - I have written a numpy extension which works fine but has a memory leak. It takes a single array argument and returns a single scalar. After reducing the code down in order to chase the problem, I have the following: It does not answer your original question, but I

[Numpy-discussion] Solving a memory leak in a numpy extension; PyArray_ContiguousFromObject

2009-04-17 Thread Dan S
Hi - I have written a numpy extension which works fine but has a memory leak. It takes a single array argument and returns a single scalar. After reducing the code down in order to chase the problem, I have the following: static PyObject * kdpee_pycall(PyObject *self, PyObject *args) {

Re: [Numpy-discussion] Solving a memory leak in a numpy extension; PyArray_ContiguousFromObject

2009-04-17 Thread Lisandro Dalcin
1) Calling both PyArray_XDECREF(array) and Py_DECREF(array) is likely wrong. 2) Py_DECREF(input) should never be done. On Fri, Apr 17, 2009 at 12:25 PM, Dan S dan.s.towell+nu...@gmail.com wrote: Hi - I have written a numpy extension which works fine but has a memory leak. It takes a single

Re: [Numpy-discussion] Solving a memory leak in a numpy extension; PyArray_ContiguousFromObject

2009-04-17 Thread Charles R Harris
On Fri, Apr 17, 2009 at 9:25 AM, Dan S dan.s.towell+nu...@gmail.comdan.s.towell%2bnu...@gmail.com wrote: Hi - I have written a numpy extension which works fine but has a memory leak. It takes a single array argument and returns a single scalar. After reducing the code down in order to chase

Re: [Numpy-discussion] Solving a memory leak in a numpy extension; PyArray_ContiguousFromObject

2009-04-17 Thread Charles R Harris
On Fri, Apr 17, 2009 at 7:37 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Fri, Apr 17, 2009 at 9:25 AM, Dan S dan.s.towell+nu...@gmail.comdan.s.towell%2bnu...@gmail.com wrote: Hi - I have written a numpy extension which works fine but has a memory leak. It takes a single

Re: [Numpy-discussion] Solving a memory leak in a numpy extension; PyArray_ContiguousFromObject

2009-04-17 Thread Charles R Harris
On Fri, Apr 17, 2009 at 9:25 AM, Dan S dan.s.towell+nu...@gmail.comdan.s.towell%2bnu...@gmail.com wrote: Hi - I have written a numpy extension which works fine but has a memory leak. It takes a single array argument and returns a single scalar. After reducing the code down in order to chase