Algorithm Used in JVM Garbage Collector

Source: Internet
Author: User
Java advanced communication group
37341439 there is no lower limit, no discrimination, and cheerful communication ~

1: reference counting method (Classic, ancient)

An object references count + 1. When count is 0, it is recycled. When a references B and B references a, it cannot be recycled. Therefore, the Java garbage collector does not use thisAlgorithm. 2: Mark-clear algorithm disadvantages: as a result, space fragments can be found from the root node to find all reachable objects, and then all unreachable objects are cleared, which may lead to many discontinuous spaces, resulting in space waste. 3: the replication algorithm is applicable to the scenarios where there are many spam objects and few surviving objects. The new generation applies this algorithm; it is highly efficient, but requires a memory of half 4: The tag-compression algorithm is used in the old age to find all reachable objects from the root node, then, the reachable objects are moved to the continuous memory space, and all reachable objects are cleared. This ensures the continuity of memory. 5: Other algorithms of the incremental algorithm process garbage at a time. If the processing time is long, it will pause for a long time. This algorithm is applicable to garbage collection threads and applications.ProgramThe thread is switched to avoid a long system pause. However, the context switching is consumed due to thread switching, and the total recovery costs increase. 6: The generation algorithm uses the replication algorithm in the new generation. In the old generation, the labeled compression algorithm is used by the garbage collector;

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.