Get the App
SLTechnology News&Howtos  ›  Development  › 

Example Analysis of JVM Runtime memory in java Development

Shulou Source: shulou.com Published: 2022-06-03 13:20:09 09月11日 Update

This article introduces the example analysis of JVM runtime memory in java development, the content is very detailed, interested friends can refer to, hope to be helpful to you.

The runtime memory of 1.JVM is also called JVM heap.

From the point of view of GC, JVM can be divided into the new generation, the old age and the eternal generation. Among them, the new generation defaults to account for 1max 3 heap memory space, while the old generation defaults to 2max 3 memory space, and permanent generation takes up very little heap memory space.

The Cenozoic era is divided into Eden,SurvivorFrom,SurvivorTo region, Eden accounts for 8x10 Cenozoic area space by default, while SurviorFrom and SurviorTo account for 1max 10.

2.JVM newly created object

JVM newly created objects, except for large objects, will be placed in the new generation. Because JVM will create objects frequently, the new generation will frequently start MinorGC for garbage collection.

3. Detailed explanation of Cenozoic era

The newly created objects in 1.Java are first placed in the Eden area, and if the objects are large, they are assigned to the elderly area.

When there is insufficient memory space in the 2.Eden area, GC will trigger a garbage collection for the new generation.

3.SurviorTo saved the survivors of the last MinorGC.

4.SuviorFrom takes the last MinorGC as the scanning object this time.

4. A detailed explanation of the old age

In the old era, MajorGC will not start frequently, and when there is still a shortage of space in the old era after MinorGC, it will trigger MajorGC for garbage collection. MajorGC uses a tag removal algorithm. It takes a long time to scan all the objects in the old days.

5. Permanent generation

Refers to the permanent storage area of memory, mainly storing Class and Meta (metadata).

This is the end of the sample analysis of JVM runtime memory in java development. I hope the above can be helpful to you and learn more. If you think the article is good, you can share it for more people to see.

Tags: Memory objects newborn Cenozoic Age Space permanent run frequent garbage examples Analysis Development content region more previous help good interest Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Shulou Information Linux Docker OPPO Reno