garbage collection
remove objects that are not used anymore
- live objects: can be reached from root
- dead objects: can't be reached from root
GC root (stack)
stack: function, primery type
heap: class instance
algorithm
- mark-sweep
- mark -sweep-compact
- copy-mark-sweep
Two Generation
young generation
- Eden
- Survivor1
- Survivor2
old generation
Garbage collectors
Stop the world
Serial - one cpu core (young generation)
Parallel - multi-cpu cores (young generation)
CMS(concurrent mark sweep) (old generation)
G1 (both young and old generation)