Next: , Previous: Object Classes, Up: Referable Objects


3.2.6.3 How References Are Tracked

Objects belonging to third class data types (data types for which objects may be referred more than once and can store references to other objects) maintain a list of references hold by other objects to themselves, in excess the reference count.

The items in the list are references (pointers, that is) to object descriptions of objects holding the references. For such purpose, data types in this third class of data types include in their definition an object description usable for reference management. Effectively, objects have pointers to objects referring them.

Such object descriptions are exchanged as struct x1f4_nodelink_type records.

See struct x1f4_nodelink_type.

The maintained list of references serves cycles detection. The detection is done (by libx1f4i0 data type implementations) by tracing up the references until an object is found to be referred by some variable or until there are no more references to trace. In the very first case no object destruction is in order, in the second a set of objects has been determined to have no references to it from outside and needs dismantling.

Why tracing up? Why tracing references hold by other objects to the currently examined object instead references hold by the currently examined object to other objects? Especially since the second tracing method, the down tracing one, does not require maintaining for each object a list of objects holding references to that object. Because objects that may be referred by other objects and that can refer other objects are likely to refer other objects far more often than they are themselves referred by other objects.