JVM GC Notes

Source: Internet
Author: User

Heap Partitioning: All new objects will be stored in the heap

> New Generation (Young Generation): Storage of short life-cycle objects, specifically divided into Eden and survivor two districts, of which survivor is divided into from space and to space; > Old Generation: Storing long-life objects > Durable generation (permenent Generation): For storing class bytecode, etc. The GC algorithm used by the JVM is: Generational collection > Frequent collection of new Generation > Less collection of old generation > Basic non-collection of persistent generations The GC mechanism of the JVM is divided into: Minor GC and full GC > Minor GC: The normal GC, which collects all the objects in the Cenozoic, copies all the living objects in Eden into the survivor, and if the survivor doesn't fit, survivor alive. Objects into the old generation > full GC: The new generation and the old generation are collected, and the algorithm is less efficient than the GC.     When you explicitly call System.GC (), the full GC is performed. > Trigger conditions: Eden is full to trigger minor GC; When new objects enter the old generation, the old generation space is insufficient JVM cleanup algorithm: > Reference counting Method (early JVM): The JVM counts the number of references to an object, creates it, adds a reference out of scope, and, when the count is 0 o'clock, collects > object reference traversal: The JVM iterates through all the root objects, determines the reachable objects recursively based on the object graph, if An object instance can arrive from the root object, it is labeled as a tagged object, and during the collection phase, simply scan the stack and delete all unmarked objects.  Compression is generally done later to make room for new objects. > Copy Cleanup method How the JVM cleans up an object: > New generation: Using the Copy cleanup method, copy the reachable objects to an unused area, such as survivor, and then clear all objects in Eden > Legacy generation: Use tag cleanup and compression, and the content is traversed by the object reference. > mechanism: Serial and parallel, string exercise for single-threaded, single-CPU, and exercise for multi-threaded, multi-core CPUs. Tuning: > Use tuning: Assign null to unused objects as early as possible, rather than wait until the exit lifecycle is automatically assigned, less finalize () will increase GC workload, and when the program waits, manually execute System.GC (); > Virtual machine optimization option: Online query

JVM GC Notes

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.