Desired survivor size 59244544 bytes, new threshold 15 (max 15) - age 1: 963176 bytes, 963176 total - age 2: 791264 bytes, 1754440 total - age 3: 210960 bytes, 1965400 total - age 4: 167672 bytes, 2133072 total - age 5: 172496 bytes, 2305568 total - age 6: 107960 bytes, 2413528 total - age 7: 205440 bytes, 2618968 total - age 8: 185144 bytes, 2804112 total - age 9: 195240 bytes, 2999352 total - age 10: 169080 bytes, 3168432 total - age 11: 114664 bytes, 3283096 total - age 12: 168880 bytes, 3451976 total - age 13: 167272 bytes, 3619248 total - age 14: 387808 bytes, 4007056 total - age 15: 168992 bytes, 4176048 total
GC 后打印堆数据
每次发生 GC 时,对比一下 GC 前后的堆内存情况,更直观
1
-XX:+PrintHeapAtGC
输出内容示例:
1 2 3 4 5 6 7 8 9 10 11
{Heap before GC invocations=0 (full 0): garbage-first heap total 1024000K, used 324609K [0x0000000781800000, 0x0000000781901f40, 0x00000007c0000000) region size 1024K, 6 young (6144K), 0 survivors (0K) Metaspace used 3420K, capacity 4500K, committed 4864K, reserved 1056768K class space used 371K, capacity 388K, committed 512K, reserved 1048576K Heap after GC invocations=1 (full 1): garbage-first heap total 1024000K, used 21755K [0x0000000781800000, 0x0000000781901f40, 0x00000007c0000000) region size 1024K, 0 young (0K), 0 survivors (0K) Metaspace used 3420K, capacity 4500K, committed 4864K, reserved 1056768K class space used 371K, capacity 388K, committed 512K, reserved 1048576K }
打印 STW 时间
暂停时间是 GC 最重要的指标,肯定不能少
1
-XX:+PrintGCApplicationStoppedTime
输出内容示例:
1
Total time for which application threads were stopped: 0.0254260 seconds, Stopping threads took: 0.0000218 seconds