The Mark-Sweep algorithm first marks all objects to be recycled and then recycles them all. Main disadvantages: 1. low marking and clearing efficiency 2. A large number of discontinuous memory fragments are generated, resulting in the subsequent allocation of large memory space failure. The replication algorithm divides the available memory into two equal-size two blocks and uses only one of them at a time. After this part is used up, the surviving objects are copied to the other part, and the used memory space is cleared once. Major disadvantage: the cost is too high, and at least half of the memory is not available. The three-mark Sorting Algorithm marking process is the same as the Mark-clearing algorithm, but the subsequent step is to move all the surviving objects to one end, and then clear the memory outside the boundary. The four-generation collection algorithm is currently used by commercial virtual machines. It is divided into different object generations for different management.