Classification
Garbage is generally classified into two types:
- semantic garbage
- Semantic garbage is any object or data which will never be accessed by a running program, for any combination of inputs to the program.
- syntactic garbage
- Syntactic garbage refers to objects or data within a program's memory space that are unreachable from the program's root set.
Note that syntactic garbage is a (usually strict) subset of semantic garbage as it is entirely possible for an object to hold a reference to another object without the latter object being used. Determination of the semantic garbage present in a program is generally undecidable, but there are many algorithms for identifying syntactic garbage.
Objects and/or data which are not garbage are said to be live.
Read more about this topic: Garbage (computer Science)