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

David Cournapeau david at ar.media.kyoto-u.ac.jp
Sat Apr 18 03:11:19 EDT 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