当前位置:网站首页>When will JVM garbage collection enter the older generation
When will JVM garbage collection enter the older generation
2022-06-26 10:08:00 【ZZ learn java well】
The new generation Minor GC There are too many surviving objects after , Could not add Survivor In the area , At this time, these must be saved to
The elephant moves directly to the old age , What if there is not enough space for the elderly at this time ?
1、 Execute any time Minor GC Before ,JVM I'll check the available memory space in the old days first , Is it larger than the new generation
Total size of all objects , Because in extreme cases , Maybe the new generation Minor GC after , The new generation needs all objects
Survive , That will cause all objects of the new generation to enter the old generation ;
2、 If the available memory of the old generation is greater than the total size of all objects of the new generation , At this time, we can safely and boldly launch the new generation
once Minor GC, because Minor GC Then even if all objects survive ,Survivor There's no room for it , You can also turn
Move to the old age ;
3、 If you execute MInor GC Before , It is found that the available space in the old age is less than the total size of all objects in the new generation ,
Then the next judgment will be made , Judge the available space in the old age , Is it greater than every time before Minor GC Backward
The average size of objects entering the old age , If you find the memory size of the old age , Greater than every time before Minor GC
The average size of objects in the late to old age , So you can take a risk and try Minor GC, But this time really can
There can be risks , That's it Minor GC later , The size of the remaining surviving objects , Greater than Survivor The size of the space , also
Larger than the amount of space available for older generations , The old generation can't let go of these surviving objects , This will trigger once “Full GC";
So the purpose of the old space allocation guarantee mechanism ? Also to avoid frequent Full GC;
4、 If Full GC after , There is still not enough space for storage in the old age Minor GC The remaining surviving objects , that
Then it will lead to “OOM” out of memory ;
Under what circumstances will the object enter the old generation
1、 Evade 15 Time GC Then into the old generation ,I It can be done by JVM Parameters "-XX:MaxTenuring Threshold" To set the age , The default is 15 year ;
2、 Dynamic object age determination ;
3、 The old space guarantee mechanism ;
4、 Large objects go directly into the old generation ;
Large objects are those that require a large amount of continuous memory space Java object , For example, a long string or a large array or
List aggregate , When large objects allocate space , It is easy to trigger garbage collection in advance when there is still a lot of space in the memory
Get enough contiguous space to store them , And when copying objects , Large objects will cause high memory replication overhead , by
To avoid those big objects in the new generation , And then repeatedly dodged GC And copy back and forth , here JVM Just put the big ,
Put the object into the old generation , Not through the new generation ;
边栏推荐
- 自动化测试——pytest框架介绍及示例
- 904. 水果成篮
- Poj3682 king arthur's birthday celebration (probability)
- 从tf 1.x到tf 2.6(遇到的就过来更新更新)
- Force buckle ----- remove the maximum and minimum values from the array
- cento7.7安装ELK简单记录
- Internationalization configuration
- 2021-11-29 quintic polynomial of trajectory planning
- Redis notes (12) - single thread architecture (non blocking IO, multiplexing) and multiple asynchronous threads
- A concise tutorial for getting started with go generics
猜你喜欢

The IE mode tab of Microsoft edge browser is stuck, which has been fixed by rolling back the update

Force buckle ----- remove the maximum and minimum values from the array

install opencv-contrib-dev to use aruco code

自动化测试——pytest本身及第三方模块介绍及使用

测试须知——常见接口协议解析

Notes on sports planning on November 22, 2021

Constraintlayout control uses full Raiders
![[trajectory planning] testing of ruckig Library](/img/c7/51c0f6dc3bf7c7fa4528118a4c32fa.png)
[trajectory planning] testing of ruckig Library

Redis novice introduction

Solution to network request crash in retrofit2.8.1
随机推荐
Extracting public fragments from thymeleaf
Introduction to stored procedure testing
Problems encountered by jupyter notebook
[trajectory planning] testing of ruckig Library
Battery historian analyzes battery consumption
Halcon photometric stereoscopic
从tf 1.x到tf 2.6(遇到的就过来更新更新)
jar版本冲突问题解决
US President signs community safety act to deal with gun issue
Retrofit common request methods and comments, post, get heard file upload
国际化配置
This new change of go 1.16 needs to be adapted: the changes of go get and go install
WGCLOUD的web ssh服务端口是多少
自动化测试——pytest本身及第三方模块介绍及使用
【二分查找】4. 寻找两个正序数组的中位数
Download MySQL database installation package website of each system and version
How about the security of flush stock trading software? How to open an account in flush
c语言语法基础之——函数 小程序 求阶乘
Do you know the //go: instructions in the go source code, go:linkname?
Recyclerview implements flow layout (LinearLayout with line wrap) (flexboxlayoutmanager)