Brian Graversen <[EMAIL PROTECTED]> writes:

> [...] All memory allocated locally using malloc will have to be
> free'd in C before returning, and then the return value is build
> using the python supplied function. It makes sure that refcount is
> incremented, and python then free's that python object when the last
> reference goes away, so all is well as I see it.

Yes, I'm pretty sure that works with no leaks.

About cleaning up memory, then it's only because you return a built-in
Python type that you have to free all allocated memory -- if we
instead made our own Python type, we could use the tp_dealloc member
to free the memory. I found a description of this here:

Martin Geisler
viff-devel mailing list (

Reply via email to