6 Miscellaneous Programming Features

6.6 Weak pointers

A weak pointer is one that does not constitute a reference from the point of view of garbage collection. Weak pointers are often used together with the notion of dead objects, that is, objects that the garbage collector would discard because there are no references to them (or objects that a stop-and-copy GC does not even look at). In Liquid Common Lisp, we provide data abstractions that embody the common applications of this concept.

weak hash tables
Hash tables in which dead keys or dead entries are deleted. The key or value in the hash table itself does not constitute a reference to the object.

weak sets
Lists of objects such that membership in the weak set is not a reference to those objects. Dead objects are removed from the set.

Weak pointers are useful for such constructs as "self-cleaning hash tables," that is, hash tables containing cells that do not constitute a reference (with respect to garbage collection).

6.6.1 - Reference pages

The Advanced User's Guide - 9 SEP 1996

Generated with Harlequin WebMaker