-
Notifications
You must be signed in to change notification settings - Fork 46k
Open
Labels
enhancementNew feature or request or suggestionNew feature or request or suggestionperfectImprove knowledge points or descriptionsImprove knowledge points or descriptions
Description
正确的表述应该是:“Hotspot遍历所有对象时,按照年龄从小到大对其所占用的大小进行累积,当累积的某个年龄大小超过了survivor区的一半时,取这个年龄和MaxTenuringThreshold中更小的一个值,作为新的晋升年龄阈值”。
动态年龄计算的代码如下
uint ageTable::compute_tenuring_threshold(size_t survivor_capacity) {
//survivor_capacity是survivor空间的大小
size_t desired_survivor_size = (size_t)((((double) survivor_capacity)*TargetSurvivorRatio)/100);
size_t total = 0;
uint age = 1;
while (age < table_size) {
total += sizes[age];//sizes数组是每个年龄段对象大小
if (total > desired_survivor_size) break;
age++;
}
uint result = age < MaxTenuringThreshold ? age : MaxTenuringThreshold;
...
}
Muggle-Sun, SuperChrisliu, cayden-cheng, bonapartecaesa, diwangace and 17 moreSuperChrisliu
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request or suggestionNew feature or request or suggestionperfectImprove knowledge points or descriptionsImprove knowledge points or descriptions