[Zope-Checkins] CVS: Components/ExtensionClass - ExtensionClass.c:1.35

Jim Fulton jim@tarzan.digicool.com
Thu, 10 Jun 1999 16:04:41 -0400


Update of /cvs-repository/Components/ExtensionClass
In directory tarzan.digicool.com:/tmp/cvs-serv1193

Modified Files:
	ExtensionClass.c 
Log Message:
Changed the destructor protocol to prevent "refcount leakage".  The
reference counts of extension classes are increased when instances are
created.  Prior to this change, the class ref counts were only
decreased by subclass destructors.  Base class destructors followed
the Python protocol and didn't DECREF thier classes (types).  (Python
type ref counts have nothing to do with instance life times, since
Python types are static, unlike extension classes, which may be
dynamic.)

This caused the ref counts of instantiatable base classes to grow,
which looked like a memory leak.

Now, the destructor protocol calls for base class destructors to
DECREF the class in addition to deallocating the object.  The subclass
destructor *only* DECREFs the class if it has to deallocate the object
because there was no base class destructor.

This also fixed an logic ordering problem that caused some dynamically
created classes to be destroyed while they were still needed.