Unreachable memory

Informally, unreachable memory is dynamic memory that the program cannot reach directly, nor get to by starting at an object it can reach directly, and then following a chain of pointer references.

In dynamic memory allocation implementations that employ a garbage collector, objects are reclaimed after they become unreachable.

Many programming languages (for example, Java, C#, D, Dylan, Julia) use automatic garbage collection.

The garbage collector can treat a weakly reachable object graph as unreachable and deallocate it.

Some garbage-collected object-oriented languages, such as Java and Python, feature weak references.