Mark-Sweep algorithm
Advantage:
- No extra space required
insufficient:
- Need to scan the whole heap of objects, low efficiency
- After recycling, a lot of fragmented space will be generated
Copying algorithm
Advantage:
- Guarantee continuous free space after recycling
- The entire space is recovered, which is more efficient
insufficient:
- Will waste some space
- Need extra space as a guarantee
Application scenario: new generation
Mark-Compact algorithm
Advantage:
- No extra space required
insufficient:
- Fragmentation recovery efficiency is low
Application scenario: old age