status: draft (2024-09-11)
keywords: Garbage Collection
See also SRFI 124: Ephemerons and SRFI 246: Guardians.This SRFI describes three concepts associated with the storage management of a Scheme system, ephemerons, guardians, and transport cell guardians.
An ephemeron is a record structure with a key and a value field. An ephemeron can be broken. Breaking an ephemeron replaces the key and value with #f. An implementation of this SRFI breaks an ephemeron when it proves that the storage occupied by the key could be reclaimed if the ephemeron were broken.
A guardian is a structure containing objects as guarded or resurrected elements. Initially, guardians are empty. Objects can be added in guarded elements to the guardian by the programmer. An implementation of this SRFI resurrects an element when it proves that the storage occupied by the object could be reclaimed if all guardians in the system were empty. Objects from resurrected elements can be queried and removed from the guardian by the programmer. Instead of the object itself, a representative can be returned.
A transport cell guardian is a structure containing transport cells, similar to a guardian. Whenever an object in a guarded transport cell in the transport cell guardian is moved by the garbage collector, the transport cell is resurrected so that it can be queried by the programmer.