This chapter describes the use of the kernel feature of weak pointers. This feature is intended for use only in GAP internals, and is not recommended for use in share packages, user code, or at the higher levels of the library.
The GASMAN garbage collector is the part of the kernel that manages memory in the users workspace. It will normally only reclaim the storage used by an object when the object cannot be reached as a subobject of any GAP variable, or from any reference in the kernel. We say that any link to object a from object b ``keeps object a alive'', as long as b is alive. It is occasionally convenient, however to have a link to an object which does not keep it alive, and this is a weak pointer. The most common use is in caches, and similar structures, where it is only necessary to remember how to solve problem x as long as some other link to x exists.
The following section Weak Pointer Objects describes the semantics of the objects that contain weak pointers. Following sections describe the functions available to manipulate them.
[Top] [Previous] [Up] [Next] [Index]
GAP 4 manual