See the Garbage Collection Handbook
Garbage collection is one of the features you may use to distinguish a "high-level" language from a lowlevel language
High-level languages "hide irrelevant details" (behind abstraction).
Glossary
- Reachability ::
Can the runtime reach this data?
- Conservative GC
- Garbage ::
Unreachable memory
- Managed language ::
A language which automatically manages memory
Contrast with a language like
C
- Precise GC
- Mark-and-Sweep ::
two-phase traversal of all reachable memory in a program
In the first phase, any data which is reachable is marked
In the second phase, any data which is not marked is swept (i.e.
freed
) - Weak Reference ::
A reference which does not protect an object from garbage-collection