当前位置:网站首页>[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
- 【JVM】G1垃圾回收器简述
- Critical applications and hyper converged infrastructure: the time has come
- Brève description du collecteur d'ordures G1
- Cb/s Architecture - Implementation Based on cef3+mfc
- Xlnet (generalized autorefressive trainingfor language understanding) paper notes
- Comparison problems encountered in recent study
- Forrester senior analyst: five important trends in the development of the hyper convergence market
- 【ARK UI】HarmonyOS ETS的启动页的实现
- Cloud native database
猜你喜欢

Comparison problems encountered in recent study

Appium自动化测试基础 — adb shell 命令

Network based dynamic routing protocol (OSPF)
![[new book recommendation] cleaning data for effective data science](/img/42/1258694fc55a178a666391669a67ad.png)
[new book recommendation] cleaning data for effective data science
![[Ubuntu redis installation]](/img/66/d8054ae89007180b317641cf92d1cc.png)
[Ubuntu redis installation]

Object detection yolov5 open source project debugging

LVS load balancing

【JVM】G1垃圾回收器簡述

prometheus 监控之 ntp_exporter

Eight sorts (I)
随机推荐
MySQL优化
Forrester senior analyst: five important trends in the development of the hyper convergence market
Framework program of browser self-service terminal based on IE kernel
【ARK UI】HarmonyOS ETS的启动页的实现
Bloom filter
基于Svelte3.x桌面端UI组件库Svelte UI
将小程序容器技术应用到物联网IoT生态建设中
ABAP time function
JUL简介
云技能提升好伙伴,亚马逊云师兄今天正式营业
Based on svelte3 X desktop UI component library svelte UI
Mysql database learning 1
The present situation and challenge of the infrastructure of Yiwen parsing database
What makes flutter special
tf. keras. layers. Attention understanding summary
qmlplugindump executable not found. It is required to generate the qmltypes file for VTK Qml
Read the difference and connection between hyperfusion and private cloud
How to reduce the delay in live broadcast in the development of live broadcast source code with goods?
【JVM】G1垃圾回收器简述
工作小记: sendto失败 errno 22