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

"V. Armando Solé" sole@esrf...
Mon Apr 20 06:39:07 CDT 2009


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 you  
return Py_None instead of your float?:

Py_INCREF(Py_None);
return PyNone;

I do not know if it will help you but I guess it falls in the "any 
further thought" category  :-)

Best regards,

Armando



More information about the Numpy-discussion mailing list