A dangling link is a reference to an object that no longer exists. Garbage is an object that cannot be reached by reference.
Dangling links do not exist in garbage collections, because objects only return when they are no longer available (only garbage is collected). In some languages ββor frameworks, you can use "weak links" that can be left dangling, as they are not taken into account during the collection.
In languages ββwith manual memory management, such as C or C ++, you may encounter dangling pointers by doing this, for example:
int * p = new int; delete p; int i = *p;
source share