next up previous contents
Next: 2.5.3 Finalization Up: 2.5 Garbage Collection Previous: 2.5.1 GC Parameters

2.5.2 Weak Pointers

A weak pointer provides a way to maintain a reference to an object without preventing an object from being garbage collected. If the garbage collector discovers that the only pointers to an object are weak pointers, then it breaks the weak pointers and deallocates the object.

[Function]
extensions:make-weak-pointer object
extensions:weak-pointer-value weak-pointer

make-weak-pointer returns a weak pointer to an object. weak-pointer-value follows a weak pointer, returning the two values: the object pointed to (or nil if broken) and a boolean value which is true if the pointer has been broken.



Raymond Toy
Mon Jul 14 09:11:27 EDT 1997