Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are Full GC and Minor GC?

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of what Full GC and Minor GC are, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will gain something after reading this article on Full GC and Minor GC. Let's take a look at it.

You may have seen a lot of GC nouns, such as Minor GC, Young GC, Full GC, Old GC, Major GC, Mixed GC.

With so many concepts, I have a headache when I think about it. what do all kinds of messy GC refer to?

The following is to quote R Da's answer on Zhihu:

For the implementation of HotSpot VM, there are actually two accurate categories of GC in it:

Partial GC (local GC): mode Young GC that does not collect the entire GC heap: GC,Young GC that only collects Young Gen there is another saying called Minor GCOld GC: only collect GC of old gen, only concurrent collection of garbage collector CMS is this mode Mixed GC: collect whole Young Gen and part of old gen GC, only garbage collector G1 has this mode Full GC: collect whole heap, including Cenozoic, old age The pattern of all parts of the permanent generation (in JDK 1.8and later, the permanent generation is removed and replaced with metaspace metaspace)

Next, let's take a look at each GC:

(1) Minor GC / Young GC

First of all, let's take a look at Minor GC / Young GC. As we all know, the new generation (Young Gen) can also be called the younger generation, and these two nouns are equivalent. So after the Eden memory area of the younger generation is full, you actually need to trigger the younger generation of GC, or the new generation of GC.

At this time, this new generation of GC, in fact, is the so-called Minor GC, can also be called Young GC, I believe that we understand these two terms, to put it bluntly, specifically for the new generation of GC.

(2) Old GC

The so-called Old Age GC is more appropriate to call it Old GC, because it can be understood literally that this is the so-called Old Age GC.

But here the reason why we call the old GC Full GC, in fact, is also possible, but a literal meaning of a variety of different terms.

In order to express the meaning of the old GC more accurately, the old GC can be called Old GC.

(3) Full GC

In fact, there is a more appropriate term for Full GC, that is, Full GC refers to garbage collection for all memory space of the new generation, the old age, and the permanent generation, so it is called Full GC.

It can also be understood literally that Full means the whole, so it is an overall garbage collection of JVM to collect all the garbage from each memory area.

(4) Major GC

Another noun is the so-called Major GC, which is generally used less, and it is also a very confusing concept.

Some people equate Major GC with Old GC, thinking that it is aimed at the old GC, while others equate Major GC with Full GC and think that it is the GC for all memory areas of JVM.

Therefore, in view of this confusing concept, it is suggested that we should not mention it in the future. If you hear someone talking about the concept of Major GC, you can ask him clearly: is he trying to talk about Old GC? Or Full GC?

(5) Mixed GC

Mixed GC is a unique concept in G1. To put it bluntly, it mainly means that in G1, once the old age occupies 45% of the heap memory (- XX:InitiatingHeapOccupancyPercent: sets the Java heap occupancy threshold that triggers the tag cycle, the default value is 45%. The Java heap ratio here refers to non_young_capacity_bytes (including old + humongous), which is about to trigger Mixed GC, which will be recycled for both the younger generation and the older generation. Mixed GC appears only in G1.

This is the end of the article on "what are Full GC and Minor GC?" Thank you for reading! I believe you all have a certain understanding of "what are Full GC and Minor GC". If you want to learn more, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report