Memory leak when using a C++ module for Python

Gabriel Genellina gagsl-py2 at
Tue Dec 16 09:16:28 CET 2008

En Thu, 11 Dec 2008 15:35:58 -0200, Jaume Bonet <jaume.bonet at>  

> This is the function that is visible from python and the one that the
> python code calls:
> static PyObject * IMFind (PyObject *self, PyObject *args, PyObject
> *kwargs) {

Your function does not call any Python function except  
PyArg_ParseTupleAndKeywords (which does not modify reference counts).
So it's unlikely that this could cause any memory leak. I'd revise how  
memory is allocated and deallocated on the C++ side.

Gabriel Genellina

More information about the Python-list mailing list