5.4.28. WeakReference Class
A WeakReference instance maintains a non-pinning reference to another
object. A non-pinning reference does not prevent an object from getting garbage
collected or having its uninit method run when there are no longer normal
references maintained to the object. Once the referenced object is eligible for
garbage collection, the reference inside the WeakReference instance will be
cleared and the
value
method will return
.nil on all subsequent calls.
WeakReferences are useful for maintaining caches of objects without preventing
the objects from being reclaimed by the garbage collector when needed.