当前位置:网站首页>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
边栏推荐
- (2006,Mysql Server has gone away)问题处理
- Babbitt | metauniverse daily must read: does the future of metauniverse belong to large technology companies or to the decentralized Web3 world
- The Child and Binary Tree-多项式开根求逆
- Study notes of canal
- Where are the laravel framework log files stored? How to use it?
- Laravel框架日志文件存放在哪里?怎么用?
- Day06 operation -- addition, deletion, modification and query
- 李沐d2l(六)---模型选择
- 【无标题】
- Cat安装和使用
猜你喜欢

论文笔记: 知识图谱 KGAT (未完暂存)

Learning notes of automatic control principle - Performance Analysis of continuous time system

Database operation skills 7

Flask project learning (I) -- sayhello

Horizontal comparison of the data of the top ten blue chip NFTs in the past half year

CSDN Top1 "how does a Virgo procedural ape" become a blogger with millions of fans through writing?

十大蓝筹NFT近半年数据横向对比

Li Mu D2L (VI) -- model selection

Form form

The child and binary tree- open root inversion of polynomials
随机推荐
Center an element horizontally and vertically
公告 | FISCO BCOS v3.0-rc4发布,新增Max版,可支撑海量交易上链
at、crontab
Self review ideas of probability theory
CF1481C Fence Painting
Li Mu D2L (V) -- multilayer perceptron
Babbitt | metauniverse daily must read: does the future of metauniverse belong to large technology companies or to the decentralized Web3 world
Nuxt - Project packaging deployment and online to server process (SSR server rendering)
Node-v download and application, ES6 module import and export
Cat安装和使用
Original root and NTT 5000 word explanation
mysql函数
垂直搜索
ext3文件系统的一个目录下,无法创建子文件夹,但可以创建文件
Day06 homework - skill question 6
CSDN Top1 "how does a Virgo procedural ape" become a blogger with millions of fans through writing?
Study notes of canal
分布式跟踪系统选型与实践
本地缓存
(2006,Mysql Server has gone away)问题处理