JVM garbage collection algorithm and garbage collector notes __ algorithm

Source: Internet
Author: User
Tags garbage collection
Overview

Program counters, local method stacks, virtual machine stacks are born with threads, and are extinguished with threads. Java heap and method area are different, this part of memory allocation and recycling are dynamic, the garbage collector is concerned about this part of memory. algorithm for determining whether an object is garbage

The JVM does not use a reference-counting algorithm to manage memory, and the main thing is that reference counting makes it difficult to solve the problem of circular references between objects. The JVM uses a accessibility analysis algorithm to determine whether an object can be recycled. Using GC Roots object as a starting point, searching down, searching through the road is called a reference chain (reference chain), which proves that the object is not available when there is no reference chain for an object to the GC roots. death of Judgment object

Determine if an object is dead, at least 2 marks. If the GC is not available after the parse object is unavailable, it is marked for the first time and is first filtered, the filter condition is the object's Finaliz () The method is overwritten and has not been executed. Then put it in the F-queue queue. The second marker is for the F-queue queue to see if the object is saving itself in the Finalize () method, or else it will be recycled. The Finalize () method for any object is only automatically invoked once by the system. Using the Finalize () method is strongly deprecated. garbage collection Algorithm mark-Purge algorithm

The most basic algorithm, the other algorithm is to improve it and complement the replication algorithm

Now the virtual machines are using this collection algorithm to reclaim the new generation. Mark-Finishing algorithm

Also known as the tag-compression algorithm. This algorithm is used in the old age of recycling. implementation of hotspot algorithm

Enumerating root Nodes

Security Point Pause GC

Secure zone GC garbage collector serial collector

The serial garbage collector is the most basic and oldest collector.

Single-threaded GC, "Stop the World" when recycled. Use the replication algorithm.

is a good choice for running virtual machines in client mode. Serial Old collector

The serial old collector is the older version of serial. The mark-finishing algorithm is used. parnew Collector

The Parnew Collector is a multithreaded version of the serial garbage collector. Parallel Scavenge collector

The Parallel scavenge collector is a new generation collector, which is collected by the replication algorithm and is a parallel multithread collector.

The main purpose of the Parallel scavenge collector is to achieve a controllable throughput. Throughput = Run user code time/(run user code time + garbage collection time) Parallel old collector

Parallel old is the older version of the Parallel scavenge collector, using multithreaded and "tag-organize" algorithms. CMS collector

The CMS (Concurrent Mark Sweep) collector is a collector with the goal of obtaining the shortest recovery pause time.

4 steps

Initial mark (Stop the World)

Concurrent markup

Re-mark (Stop the World)

Concurrency cleanup G1 collector

Parallel and concurrent, generational collection, spatial integration, predictable pauses

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.