当前位置:网站首页>Conditions for JVM to trigger minor GC
Conditions for JVM to trigger minor GC
2022-07-26 09:12:00 【yuhui66666688gfbfdy】
One 、 Concept :
JVM It's going on GC when , Not every time , Old age , Method area , Three memory areas are reclaimed together , Most of the time recycling refers to the new generation .
Two 、 classification :
in the light of HotSpot VM The implementation of the , It's inside GC According to the recycling area, it is divided into two categories :
One is partial collection (Partial GC), One is the whole collection (Full GC).
Part of the collection ( Not the whole collection Java Garbage collection ) It is divided into :
a. Cenozoic collection (Minor GC / Young GC): It's just a new generation of garbage collection .
b. Old age collection (Major GC/ Old GC): It's just garbage collection in the old days .
At present, only CMS GC Will collect the behavior of old age separately .
Be careful : A lot of times Major GC Hui He Full GC To confuse with , It is necessary to specifically distinguish whether it is an old-fashioned collection or a whole stack collection
c. Mixed collection (Mixed GC) : Collect the collection of the whole Cenozoic and some old ages .( at present , Only G1 GC There's going to be this kind of behavior )
Collect the whole pile (Full GC): Collect the whole java Garbage collection in the heap and method area .
3、 ... and GC The trigger condition :
( One ) The younger generation GC(Minor GC) The trigger condition :
a. When there was not enough space for the younger generation , It will trigger Minor GC, The young generation here refers to Eden When the area is full ,Survivor Full will not trigger GC( Every time Minor GC Will clean up the memory of the younger generation )
b. because Java Most of the objects have the characteristics of living and dying , therefore Minor GC Very often , Generally, the recovery speed is relatively high .
c.Minor GC May trigger STW, Pause other users' threads , When the garbage collection is over , The user thread will resume running .
( Two ) Old age GC (Major GC) Trigger mechanism :
a. Of or occurring in old age GC, When objects disappear from the old age , We said “Major GC” or “Full GC” It happened. .
b. appear Major GC, Often accompanied by at least once Minor GC( But not absolutely , stay Parallel Scavenge In the collection strategy of the collector, there is a direct process Major GC The strategic choice of .)
When the space for the elderly generation is insufficient , Will try to trigger Minor GC. If there's not enough space after that , The trigger Major GC
c.Major GC It's usually faster than Minor GC slow 10 times above ,STW Longer time .
d. If Major GC after , Not enough memory , Report on OOM 了
( 3、 ... and ) Collect the whole pile (Full GC) Trigger mechanism :
a. call System.gc() when , System recommendation implementation Full GC, But not necessarily .
b. There is not enough space in the old age .
c. Insufficient method space .
d. adopt Minor GC The average size of the younger generation is larger than the available memory of the older generation .
e. from Eden District ,survivor space0(From Space) District direction survivor space1(To Space) When copying , Object greater than To Space Available memory , Then the object is transferred to the old generation , And the available memory of the old age is smaller than the size of the object .
explain :Full GC It's something to avoid in development or tuning , So the pause time will be shorter
边栏推荐
- 基于序的评价指标 (特别针对推荐系统和多标签学习)
- 深度学习常用激活函数总结
- Day06 homework - skill question 6
- 220. Presence of repeating element III
- Grain College of all learning source code
- Node-v download and application, ES6 module import and export
- Introduction to excellent verilog/fpga open source project (30) - brute force MD5
- mysql函数
- 语音聊天app源码——钠斯直播系统源码
- PAT 甲级 A1034 Head of a Gang
猜你喜欢

2022茶艺师(中级)特种作业证考试题库模拟考试平台操作

2022年上海市安全员C证考试试题及模拟考试

Learning notes of automatic control principle --- linear discrete system

187. Repeated DNA sequence

220. Presence of repeating element III

Nuxt - Project packaging deployment and online to server process (SSR server rendering)

QtCreator报错:You need to set an executable in the custom run configuration.

Announcement | FISCO bcos v3.0-rc4 is released, and the new Max version can support massive transactions on the chain

Day 6 summary & database operation

Matlab 绘制阴影误差图
随机推荐
ext4文件系统打开了DIR_NLINK特性后,link_count超过65000的后使用link_count=1来表示数量不可知
PHP和MySQL获取week值不一致的处理
PHP 之 Apple生成和验证令牌
JS - DataTables 关于每页显示数的控制
The Child and Binary Tree-多项式开根求逆
Flask project learning (I) -- sayhello
Uploading pictures on Alibaba cloud OSS
Introduction to excellent verilog/fpga open source project (30) - brute force MD5
The largest number of statistical absolute values --- assembly language
Elastic APM安装和使用
MySQL strengthen knowledge points
Day06 homework - skill question 6
Probability model in machine learning
力扣题DFS
十大蓝筹NFT近半年数据横向对比
MySQL 强化知识点
多项式开根
756. 蛇形矩阵
Babbitt | metauniverse daily must read: does the future of metauniverse belong to large technology companies or to the decentralized Web3 world
Database operation topic 2