12
12
<a-button @click =" showArgsHelp" style =" margin : 0 10px " >参数说明</a-button >
13
13
</a-form-item >
14
14
<a-form-item >
15
- <a-button @click =" restartJvm" class =" restart-button" :loading =" isRestarting" >重启
16
- JVM</a-button >
15
+ <a-button @click =" restartJvm" class =" restart-button" :loading =" isRestarting" >
16
+ 重启 JVM
17
+ </a-button >
17
18
</a-form-item >
18
19
<a-form-item >
19
20
<a-button @click =" showLogicTable" >内存管理逻辑</a-button >
125
126
</a-space >
126
127
</div >
127
128
128
- <div class =" jvm-memory-visualizer" >
129
-
130
- <div class =" memory-container" >
131
-
132
-
133
-
134
- </div >
135
- </div >
136
-
137
129
<!-- https://docs.oracle.com/javase/8/docs/technotes/tools/unix/java.html -->
138
130
<a-modal v-model:visible =" showHelpModal" title =" JVM 参数说明" :footer =" false" width =" 1000px" >
139
131
<a-table :data =" jvmArgsHelp" :pagination =" false" >
@@ -486,6 +478,15 @@ class gc {
486
478
}
487
479
}
488
480
481
+ const ageMap = new Map <number , number >();
482
+ heapObjects .value
483
+ .filter (o => o .space === currentFromSpace .value )
484
+ .forEach (o => {
485
+ ageMap .set (o .age , (ageMap .get (o .age ) || 0 ) + o .size );
486
+ });
487
+
488
+ console .log (ageMap )
489
+
489
490
heapObjects .value
490
491
.filter (obj => obj .space === currentFromSpace .value )
491
492
.forEach (obj => {
@@ -500,23 +501,19 @@ class gc {
500
501
return put2OldGen (obj )
501
502
} else {
502
503
// 动态年龄判定
503
- const ageMap = new Map <number , number >();
504
- heapObjects .value
505
- .filter (o => o .space === currentFromSpace .value )
506
- .forEach (o => {
507
- ageMap .set (o .age , (ageMap .get (o .age ) || 0 ) + o .size );
508
- });
509
-
510
504
let totalSize = 0 ;
511
- let targetAge = obj . age ;
505
+ let targetAge = MAX_TENURING_THRESHOLD . value + 1 ;
512
506
for (let age = 0 ; age <= obj .age ; age ++ ) {
513
507
totalSize += ageMap .get (age ) || 0 ;
508
+ console .log (' age:' , age , ' totalSize:' , totalSize , ' ration:' , survivorSize .value * memoryConfig .value .targetSurvivorRatio / 100 )
514
509
if (totalSize > survivorSize .value * memoryConfig .value .targetSurvivorRatio / 100 ) {
515
510
targetAge = age ;
516
511
break ;
517
512
}
518
513
}
519
514
515
+ console .log (obj .age , ' targetAge:' , targetAge )
516
+
520
517
if (obj .age >= targetAge ) {
521
518
operationLogs .value .unshift (` 对象 ${obj .name } 因动态年龄判定晋升到老年代 ` );
522
519
return put2OldGen (obj );
0 commit comments