strong reference
A normal reference that keeps the object it points to alive; a weak reference does not stop garbage collection.
In more detail
A Map holds its keys strongly, so objects used as keys never get collected while the map exists. WeakMap, WeakSet and WeakRef hold weakly.
Related terms
- WeakMap — A key-value collection whose keys must be objects and are held weakly, so an entry disappears when its key object is garbage collected.
- WeakRef — An object that holds a weak reference to another object; deref() returns the object, or undefined once it has been collected.
- reachability — Whether an object can still be reached by following references from roots such as global variables and the current call stack.
Taught in
- Memory Management: Garbage Collection, Memory Leaks And WeakMap — Frontend Architecture & Web Platform