[Pyrex] __del__ not called on some objects
Greg Ewing
greg.ewing at canterbury.ac.nz
Mon Aug 29 04:56:56 CEST 2005
John (J5) Palmieri wrote:
> I just found a bug during my attempts to debug some memory leaks in the
> dbus bindings. We use __del__ to unref some C objects when the wrapper
> Pyrex object goes out of scope. The problem was our Message object was
> not calling __del__ and causing a huge memory leak.
It seems that, contrary to what I said in the Language
Overview, __del__ methods are *not* called on extension
types, only on instances of Python classes (which is
why it worked when you subclassed your class).
As another poster mentioned, you want to use a
__dealloc__ method instead.
--
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury, | A citizen of NewZealandCorp, a |
Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. |
greg.ewing at canterbury.ac.nz +--------------------------------------+
More information about the Pyrex
mailing list