Ephemerons is intended for questions related to garbage collection of key/value data structures where the key might be reachable from the value
An ephemeron has pointers to key and value objects; the value is reachable if both the ephemeron and the key are reachable. In an ephemeron table, a value is only alive when its key is alive.
In the .Net CLR, the DependentHandle class an implementation of ephemerons. In ECMAScript-6, WeakSet and WeakMap are implemented as ephemeron tables. In GNU Smalltalk, finalization is implemented with ephemerons.
References
- Racket Reference: Ephemerons
- MIT Scheme Reference: Ephemerons
- SRFI-124: Ephemerons
- OCaml Manual: Module Obj.Ephemeron
- Smalltalk Manual: Special Objects - makeEphemeron
- Eliminating Cycles in Weak Tables (pdf)
- Extending Garbage Collection to complex data structures (pdf)
- Garbage Collecting Weak Tables
- ES6 in Depth: Collections
- GNU Smalltalk Manual: Special Objects
- The cost of weak pointers and finalizers in GHC
- Should ConditionalWeakTable<TKey, TValue> be used for non-compiler purposes?
- Understanding ConditionalWeakTable