当前位置:网站首页>jvm-05. garbage collection
jvm-05. garbage collection
2022-06-23 05:56:00 【CaptainCats】
Garbage collection
What is rubbish
jvm in new Out object , When there is no reference to it , It's garbage .
Garbage location
Reference count
When the reference count changes to 0 It becomes garbage .
however , The reference count will have no way to locate the garbage object of circular reference ,
for example , There are three objects that reference each other ,
But no other external references point to them , They are all rubbish .
The garbage is also a pile of garbage when it is picked up ( laugh cry).
Reachability analysis
Java This method is adopted
take "GC Roots" As a starting point , Start from these nodes and drill down to the referenced objects ,
Objects on the entire chain of references are marked as non garbage , The rest of the unmarked objects are garbage .
GC Roots: Thread stack local variables 、 Static variables 、 Variables of local method stack, etc .
Recycling of garbage
Three methods 
Mark clear
Mark → And then remove 
advantage : Simple method , The efficiency is higher when there are many surviving objects ,
shortcoming : Scan both sides , Low efficiency , It is also easy to produce fragments .
Because the reclaimed space will produce discontinuous memory .
Copy
Divide the space in two , Half of them are not used ,
During recycling, the surviving objects are neatly copied to the other half of the space .
advantage : There are no fragments ,
shortcoming : Waste space , Half the space is always free .
Tag compression
Mark → Then clean up the space when you clean it up 
It is time consuming , The least efficient one , Because while cleaning up .
These three methods have their own characteristics , In practical application, it is generally used in combination .
Heap memory partition

Young people die in large numbers , Little survival , Recycle by copying ,
The survival rate of the older generation is high , Less recycling , use MS or MC, Mark removal and mark compression .
The recycling of Eden Park will have a feature , After a recycle, a large number of objects will be cleared ,
The recycling scope includes Eden Park and the current survivor area , experienced minor GC Surviving objects , Generational age will +1,
Generation age does not reach a certain value , for example 15, Will be copied to another survivor zone , Otherwise, move to the old age .
The object of these situations will be put into the old age ( The allocation of objects )


边栏推荐
- MySQL面试真题(二十六)——滴滴2020年笔试题
- MySQL面试真题(二十二)——表连接后的条件筛选及分组筛选
- 技能自检 | 想当测试Leader,这6项技能你会吗?
- What does the English letter PC mean? What does the Internet PC mean
- Activity启动模式和生命周期实测结果
- Alibaba cloud ack one and ACK cloud native AI suite have been newly released to meet the needs of the end of the computing era
- 数字藏品如何赋能经济实体?
- ArcTime 制作中英文字幕视频
- Data migration from dolphin scheduler 1.2.1 to dolphin scheduler 2.0.5 and data test records after migration
- Opencv display image
猜你喜欢

如何指定pig-register项目日志的输出路径

Adnroid activity screenshot save display to album view display picture animation disappear

Real MySQL interview questions (XXVII) -- Classification of users by RFM analysis method

Deploy docker and install MySQL in centos7

Real MySQL interview question (30) -- shell real estate order analysis

How to move the software downloaded from win11 app store to the desktop
![[image fusion] sparse regularization based on non convex penalty to realize image fusion with matlab code](/img/e2/24eb2a60e3dc603b3ec4bfefd0b8e5.png)
[image fusion] sparse regularization based on non convex penalty to realize image fusion with matlab code

jvm-01.指令重排

技能自检 | 想当测试Leader,这6项技能你会吗?

Centos7 installation of postgresql8.2.15 and creation of stored procedures
随机推荐
Wechat applet: a new interesting test
visdom的使用
Excel sheet column number for leetcode topic resolution
Centos7部署radius服务-freeradius-3.0.13-15.el7集成mysql
PAT 乙等 1026 程序运行时间
Activity启动模式和生命周期实测结果
MySQL面试真题(二十五)——常见的分组比较场景
Work accumulation - judge whether GPS is on
JS面试题----防抖函数
Data migration from dolphin scheduler 1.2.1 to dolphin scheduler 2.0.5 and data test records after migration
True question of MySQL interview (29) -- case - finding favorite movies
APP SHA1获取程序 百度地图 高德地图获取SHA1值的简单程序
jvm-04.对象的内存布局
vant weapp日历组件性能优化 Calendar 日历添加min-date最小日期页面加载缓慢
数字藏品到底有什么魔力?目前有哪些靠谱的团队在开发
JS interview question - anti shake function
技术开发团队视角看到的数字藏品机遇与挑战
Use of visdom
Real MySQL interview question (30) -- shell real estate order analysis
True MySQL interview question (21) - Finance - overdue loan