File tree Expand file tree Collapse file tree 2 files changed +14
-11
lines changed Expand file tree Collapse file tree 2 files changed +14
-11
lines changed Original file line number Diff line number Diff line change 1
1
更多原创内容和干货分享:
2
2
3
3
1 . [ 公众号—JavaGuide] ( #公众号 ) : 最新原创文章+免费领取本文档配套的《Java面试突击》以及Java工程师必备学习资源)
4
- 2 . [ 微信] ( #联系我 ) :如果需要和我交流的话可以加我私人微信(ps: 有问题的话也可以问,我会尽量回答大家。 我很随和的,哈哈!另外,账号快加满了)
4
+ 2 . [ 微信] ( #联系我 ) :如果需要和我交流的话可以加我私人微信(ps: 有问题的话也可以问,我会尽量回答大家, 我很随和的,哈哈!另外,账号快加满了)
5
5
3 . [ B站-Guide哥] ( https://space.bilibili.com/504390397 ) :(各种干货视频和生活向视频,来个一键三连可好!)
6
6
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/ )
7
7
Original file line number Diff line number Diff line change @@ -159,21 +159,24 @@ public class GCTest {
159
159
> ``` c++
160
160
> uint ageTable::compute_tenuring_threshold (size_t survivor_capacity) {
161
161
> //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;
171
171
> ...
172
172
> }
173
173
>
174
174
> ```
175
175
>
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.**
177
180
178
181
179
182
## 2 对象已经死亡?
You can’t perform that action at this time.
0 commit comments