[pygtk] PyGObject leaking?

John Ehresman jpe at wingware.com
Fri Apr 13 22:13:24 WST 2007


Tony Nelson wrote:
>> However when a object is part of a
>> cycle, the count won't go to 0 until the cyclic gc runs.  Every python
>> wrapper for a GObject derived instance is part of a cycle, so these
>> objects are not disposed of until the gc runs.
> 
> Doesn't make it any less a bug, even if it is a very hard bug.

I'd say it's an enhancement that would be very nice to have, if only to 
prevent surprises when people first encounter it.  Generally what 
happens though is people run into it, figure out what's happening, and 
then either realize it's not a real problem or rework their code a bit 
to avoid it.

There are two objects here -- a GObject managed and ref counted by the 
gobject runtime and a PyObject managed and ref counted by the Python 
runtime.  Each can have state and the challenge is to synchronize their 
lifetimes.  I encourage you to read through the bug discussion and 
perhaps trace through the code with a C debugger if you're interested in 
this.

Cheers,

John


More information about the pygtk mailing list