Java Virtual Machine: Garbage collection algorithm of Java Virtual Machine

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.