当前位置:网站首页>[JVM] G1 garbage collector
[JVM] G1 garbage collector
2022-06-30 09:57:00 【Right eye remnant】
Tips : When the article is finished , Directories can be generated automatically , How to generate it, please refer to the help document on the right
G1 A brief description of the garbage collector
Why not use CMS?
Previous introduction CMS The purpose is to minimize the response pause time , Is a milestone in the garbage collector ,CMS It is divided into Background and Foreground, Background Is normal mode , The whole recovery process is divided into 4 Step : Initial marker , Concurrent Tags , Re label , Concurrent elimination , In order to avoid the large amount of data for full scan , After the concurrent marking process Eden Area capacity reaches 2M, There is a pre marking phase , When the occupied space reaches Eden Of 50% Terminate this phase and proceed to retag ;Foreground Error environment entered for concurrency failure , The execution status is single thread .
Even though CMS The response pause time is very good , But throughput is ignored , In single thread or dual thread state CMS Is also in poor condition , Because when two threads are concurrent , It is divided into a business thread and a garbage collection thread , Also exist CPU The scheduling of results in frequent context switching , So the efficiency loss problem .
secondly , In the terminable pre marking phase , If it doesn't happen minor GC,CMS The limit time of pause is 5s; And enter foreground Also said CMS Need to carry out Full GC;
Sum up :CMS The drawback is that his concurrency fails , Unpredictable pauses and low throughput .
G1 summary
G1 Purpose :Garbage First, That is, the garbage priority principle , That is, the focus of space . At the same time, the pause time and throughput are taken into account .
G1 Redefine memory space , No longer divided by physical space Old and Young, Instead, the memory is logically divided into several Region, Default in memory Region by 2048 individual , Every Region The size is 1M~32M
Objects are divided into : Free object (Empty), The new generation (Eden, Survivor),Old Zones and large objects
Region For their own role is not fixed , The next time the space is allocated, the role will start from Old Turn into E Or other
JDK11 Then there is a special kind of partition , It is called archive partition , Close the archive partition and open the archive partition
TLAB: Thread allocates memory locally , stay G1 When allocating object memory in , because G1 Is a concurrent garbage collector , At the same time, high concurrency , This involves the problem of data concurrency security, which requires a global lock to ensure data security , But it will bring about a decline in efficiency .
TLAB yes Eden A part of an area on an area (1%), When allocating memory, first judge TLAB Can I assign , If not , Will choose TLAB External Region Distribution of areas , If there is still insufficient space to proceed Full GC.
Other concepts
RSet: Application set , yes G1 The realization of middle pair and memory set , analogy CMS Card table in .
stay G1 in , Suppose there is A Region, Rset Will record other Region perform A The record of ;
Q: What are the advantages of doing so ?
A: Suppose if there is O The zone object points to Y District ( It feels like the opposite is true ), When recycling the new generation , Also need to O The region is traversed once , Indirectly, it becomes a full scan , And by Rset You can record : Set here Y The object of the zone is A, therefore Rset The record in is O Zone reference , All you need to do is scan Rset You can know all the references , No full scan is required .
The part that has not been studied in depth : Sparse table , Coarse grained bitmap , Fine grained bitmap
边栏推荐
- Recommend a very easy-to-use network communication framework HP socket
- 云技能提升好伙伴,亚马逊云师兄今天正式营业
- 3.集成eslint、prettier
- Based on svelte3 X desktop UI component library svelte UI
- NER – Named Entity Recognition Summary
- 将小程序容器技术应用到物联网IoT生态建设中
- 浏览器复制的网址粘贴到文档是超链接
- The present situation and challenge of the infrastructure of Yiwen parsing database
- 【JVM】G1垃圾回收器简述
- Critical applications and hyper converged infrastructure: the time has come
猜你喜欢

How to reduce the delay in live broadcast in the development of live broadcast source code with goods?

布隆过滤器

Brève description du collecteur d'ordures G1
![[new book recommendation] DeNO web development](/img/86/27906ae378e597cf64bb2d760a9dff.png)
[new book recommendation] DeNO web development

磁悬浮3D灯

Flume learning 1

MySQL优化

单片机 MCU 固件打包脚本软件

Rider打开Unity脚本后没有提示

P. Summary of NP, NPC, NP hard and other issues
随机推荐
Object detection yolov5 open source project debugging
Shell script multi loop experiment
直播带货源码开发中,如何降低直播中的延迟?
Stack Title: String decoding
utils 协程
log4j
抽象类和接口
CRF (conditional random field) learning summary
ABAP-时间函数
MySQL internal component structure
【新书推荐】Cleaning Data for Effective Data Science
近期学习遇到的比较问题
MySQL optimization
3.集成eslint、prettier
单片机 MCU 固件打包脚本软件
Add / delete query of topic
Read the difference and connection between hyperfusion and private cloud
【JVM】G1垃圾回收器简述
力扣 428. 序列化和反序列化 N 叉树 DFS
prometheus 监控之 ntp_exporter