Skip to content

Commit 4fb2492

Browse files
committed
默认的晋升年龄是15的说法完善
1 parent a8251a8 commit 4fb2492

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
更多原创内容和干货分享:
22

33
1. [公众号—JavaGuide](#公众号) : 最新原创文章+免费领取本文档配套的《Java面试突击》以及Java工程师必备学习资源)
4-
2. [微信](#联系我) :如果需要和我交流的话可以加我私人微信(ps: 有问题的话也可以问,我会尽量回答大家我很随和的,哈哈!另外,账号快加满了)
4+
2. [微信](#联系我) :如果需要和我交流的话可以加我私人微信(ps: 有问题的话也可以问,我会尽量回答大家我很随和的,哈哈!另外,账号快加满了)
55
3. [B站-Guide哥](https://space.bilibili.com/504390397):(各种干货视频和生活向视频,来个一键三连可好!)
66
4. [知识星球—JavaGuide读者圈](https://javaguide.cn/2019/01/02/chat/%E5%81%9A%E4%BA%86%E4%B8%80%E4%B8%AA%E5%BE%88%E4%B9%85%E6%B2%A1%E6%95%A2%E5%81%9A%E7%9A%84%E4%BA%8B%E6%83%85/)
77

docs/java/jvm/JVM垃圾回收.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -159,21 +159,24 @@ public class GCTest {
159159
> ```c++
160160
> uint ageTable::compute_tenuring_threshold(size_t survivor_capacity) {
161161
> //survivor_capacity是survivor空间的大小
162-
> size_t desired_survivor_size = (size_t)((((double) survivor_capacity)*TargetSurvivorRatio)/100);
163-
> size_t total = 0;
164-
> uint age = 1;
165-
> while (age < table_size) {
166-
> total += sizes[age];//sizes数组是每个年龄段对象大小
167-
> if (total > desired_survivor_size) break;
168-
> age++;
169-
> }
170-
> uint result = age < MaxTenuringThreshold ? age : MaxTenuringThreshold;
162+
> size_t desired_survivor_size = (size_t)((((double) survivor_capacity)*TargetSurvivorRatio)/100);
163+
> size_t total = 0;
164+
> uint age = 1;
165+
> while (age < table_size) {
166+
> total += sizes[age];//sizes数组是每个年龄段对象大小
167+
> if (total > desired_survivor_size) break;
168+
> age++;
169+
> }
170+
> uint result = age < MaxTenuringThreshold ? age : MaxTenuringThreshold;
171171
> ...
172172
> }
173173
>
174174
> ```
175175
>
176-
>
176+
> 额外补充说明([issue672](https://github.com/Snailclimb/JavaGuide/issues/672)):**关于默认的晋升年龄是15,这个说法的来源大部分都是《深入理解Java虚拟机》这本书。**
177+
> 如果你去Oracle的官网阅读[相关的虚拟机参数](https://docs.oracle.com/javase/8/docs/technotes/tools/unix/java.html),你会发现`-XX:MaxTenuringThreshold=threshold`这里有个说明
178+
>
179+
> **Sets the maximum tenuring threshold for use in adaptive GC sizing. The largest value is 15. The default value is 15 for the parallel (throughput) collector, and 6 for the CMS collector.默认晋升年龄并不都是15,这个是要区分垃圾收集器的,CMS就是6.**
177180
178181
179182
## 2 对象已经死亡?

0 commit comments

Comments
 (0)