My C module crashes
Daniel Dittmar
daniel.dittmar at sap.corp
Mon Feb 28 11:38:16 EST 2005
Egil Moeller wrote:
> I've written a C-module for Python, and it works as intended, but
> obviously does something wrong with its memmory management (refference
> counting), as it causes Python to segfault now and then (randomly,
> whey :S)
You can atry to use the Python function sys.getrefcount. Print the
refcount of the parameter values before and after your extension gets
called and print the refcount of the return value (s). I once forgot to
increment the refcount of the None object which was put into the return
tuple.
If you pass a list as a parameter, you should also print the refcounts
of the list elements etc.
Daniel Dittmar
More information about the Python-list
mailing list