SWIG typemap leading to a memory leak

Istvan Albert ialbert at mailblocks.com
Mon Aug 18 19:38:56 EDT 2003


Skip Montanaro wrote:
> You need to DECREF the result of PyInt_FromLong(key):

> PyDict_SetItem will bump the reference counts of the objects you pass into
> it.  When the dictionary goes away, it does its DECREFs, but all those
> integers still have non-zero reference counts as a result of their initial
> creation by PyInt_FromLong.  You have to take care of that.

Fixed my problem right away.

Thanks a bunch!

Istvan.





More information about the Python-list mailing list