当前位置:网站首页>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
边栏推荐
- 聪明的美食家 C语言
- JS closure: binding of functions to their lexical environment
- ES6 modular import and export) (realize page nesting)
- Center an element horizontally and vertically
- 围棋智能机器人阿法狗,阿尔法狗机器人围棋
- 【LeetCode数据库1050】合作过至少三次的演员和导演(简单题)
- zsh: command not found: nvm
- 高数 | 武爷『经典系列』每日一题思路及易错点总结
- PAT 甲级 A1034 Head of a Gang
- Numpy Foundation
猜你喜欢
CF1481C Fence Painting
公告 | FISCO BCOS v3.0-rc4发布,新增Max版,可支撑海量交易上链
Nuxt - 项目打包部署及上线到服务器流程(SSR 服务端渲染)
2022化工自动化控制仪表操作证考试题模拟考试平台操作
The Child and Binary Tree-多项式开根求逆
[leetcode database 1050] actors and directors who have cooperated at least three times (simple question)
Voice chat app source code - Nath live broadcast system source code
[eslint] Failed to load parser ‘@typescript-eslint/parser‘ declared in ‘package. json » eslint-confi
分布式跟踪系统选型与实践
QtCreator报错:You need to set an executable in the custom run configuration.
随机推荐
Day06 homework - skill question 6
zsh: command not found: nvm
Original root and NTT 5000 word explanation
Study notes of automatic control principle -- correction and synthesis of automatic control system
Hbuilderx runs the wechat developer tool "fail to open ide" to solve the error
聪明的美食家 C语言
【ARKit、RealityKit】把图片转为3D模型
C# Serialport的发送和接收
codeforces dp合集
机器学习中的概率模型
Study notes of canal
Flask project learning (I) -- sayhello
Where are the laravel framework log files stored? How to use it?
Day06 homework - skill question 7
深度学习常用激活函数总结
PAT 甲级 A1076 Forwards on Weibo
力扣——二叉树剪枝
Unity topdown character movement control
ext3文件系统的一个目录下,无法创建子文件夹,但可以创建文件
Go intelligent robot alpha dog, alpha dog robot go