[Date Prev][Date Next][Thread Prev][Thread Next][Author Index][Date Index][Thread Index]

Minor GC issue



To be remembered, (to prevent subtle GC bugs in the future):

Currently, only Vars (in particular, CheckedPtrVar and IntegerVar) may be
member objects of [DEFERRED_]CHECKED_CLASS()es classes.

Should we define any new classes which might be used in this way, they
must maintain the following property:

  No member object of a [DEFERRED_]CHECKED_CLASS() may allocate memory
  (or otherwise provoke a garbage collection) during its construction.

The reason:  CheckedPtrVars are not initialized to NULL until they are
constructed, but they are within the GarbageCollector's horizon as soon
as ANY member object (at that level of the containing class' inheritance
hierarchy) is being constructed.  Thus, a member object whose construction
provokes a garbage collection risks invoking the GC while invalid pointers
exist in the data structure it must walk.

	michael