1. Mark-Clear
Mark objects that need to be recycled
Uniformly reclaim all tagged objects after the tag is complete
Insufficient:
Inefficient, resulting in too much memory fragmentation
2. Copy algorithm
Divide the whole memory into two pieces
When a piece of memory ran out
Copy the surviving object to another piece
Clean up the memory you just used
Advantages: Simple to implement, efficient to run, no debris generation
Insufficient: Space costs are high, reducing memory by half
3. Marking-Sorting algorithm
Let all the surviving objects move toward one end
Clean up memory outside the boundary of the tuning port
4. Collection of Generations
Divide the Java heap into the new generation and the old age
New generation: Every garbage collection has a large number of objects dead, few objects surviving (method 2)
Old age: High object Survival (marker-finishing)
This article is from the "11801219" blog, please be sure to keep this source http://11811219.blog.51cto.com/11801219/1795266
Java garbage Collection algorithm