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

David Cournapeau david@ar.media.kyoto-u.ac...
Sat Apr 18 02:11:19 CDT 2009


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 would advise you to use
cython to make your own extension, unless cython cannot do/is not
practical to do what you want.

Refcounting is quite difficult to get right, and refcount bugs are
difficult to trackdown (they are even more difficult to track down than
malloc/free problems in my experience).

David


More information about the Numpy-discussion mailing list