Previous: Detecting Cycles, Up: Referable Objects


3.2.6.5 Reference Tracking Mechanics

Objects tracking references to themselves maintain a list of such references. The list items are the very objects holding the references, known by the address of one of their attribute, a certain struct x1f4_nodelink_type one.

See struct x1f4_nodelink_type.

Otherwise stated, objects in the libx1f4i0 type system, those object holding reference and being referred themselves that is, embed some struct x1f4_nodelink_type record. The address at which this record is stored is offered to the referred objects for reference up tracing purposed. Such struct x1f4_nodelink_type record needs to be set up before it is used. The list of references hold by other objects to itself that one object maintains is a list of pointers to struct x1f4_nodelink_type records.

The struct x1f4_nodelink_type record has some certain slip field. The field is the flag space required for tracking the already visited references when running the cycle detection algorithm. It needs be NULL outside the algorithm itself.

The other struct x1f4_nodelink_type record field is some miss address of some routine determining whether the object for which it is defined (the object embedding the struct x1f4_nodelink_type record from which is was picked up) is referred by some variable(s) and thus not to be freed. The method is expected to return some non zero value if the object is positively variable(s) referred, zero otherwise.

When called, the routine indicated by the miss field will be supplied with the execution context, some address of some struct x1f4_nodelink_type pointer to construct the linked list of visited references and the address of the struct x1f4_nodelink_type record from which the routine itself was picked up, as arguments, in this order.

What such routine would tipically do is: