14回复
2年前
【赏金20元】G1发生Full GC之后,gc日志显示堆的总大小也变小了,感觉突破尝试了
我们用的是G1回收器,堆大小配置为1G。今天生产上发生了oom,于是去看gc日志,但是看到神奇的一幕了。从日志可以看到,在9点57分05秒的时候,发生了两次full GC,但这两次full GC日志显示,堆的总大小也被改变了,真是神奇。有大神知道原因吗,感觉突破我的认知了。 日志如下,第一段是是启动参数,后面是日志详情。
Java HotSpot(TM) 64-Bit Server VM (25.141-b15) for linux-amd64 JRE (1.8.0_141-b15), built on Jul 12 2017 04:21:34 by "java_re" with gcc 4.3.0 20080428 (Red Hat 4.3.0-8)
Memory: 4k page, physical 65808472k(11203444k free), swap 41943032k(30453876k free)
CommandLine flags: -XX:InitialHeapSize=1052935552 -XX:MaxHeapSize=1073741824 -XX:+PrintGC -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseG1GC
2022-09-30T09:57:05.926+0800: 49600.505: [GC concurrent-mark-start]
, 0.0112612 secs]
[Root Region Scan Waiting: 3.9 ms]
[Parallel Time: 5.2 ms, GC Workers: 13]
[GC Worker Start (ms): Min: 49600505.2, Avg: 49600506.3, Max: 49600510.2, Diff: 5.0]
[Ext Root Scanning (ms): Min: 0.0, Avg: 0.7, Max: 2.8, Diff: 2.8, Sum: 8.7]
[Update RS (ms): Min: 0.0, Avg: 0.3, Max: 0.5, Diff: 0.5, Sum: 3.5]
[Processed Buffers: Min: 0, Avg: 1.0, Max: 3, Diff: 3, Sum: 13]
[Scan RS (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0]
[Code Root Scanning (ms): Min: 0.0, Avg: 0.0, Max: 0.2, Diff: 0.2, Sum: 0.2]
[Object Copy (ms): Min: 0.0, Avg: 1.9, Max: 2.8, Diff: 2.8, Sum: 24.8]
[Termination (ms): Min: 0.0, Avg: 1.1, Max: 1.4, Diff: 1.4, Sum: 14.5]
[Termination Attempts: Min: 1, Avg: 1.8, Max: 4, Diff: 3, Sum: 24]
[GC Worker Other (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.1]
[GC Worker Total (ms): Min: 0.0, Avg: 4.0, Max: 5.1, Diff: 5.1, Sum: 51.8]
[GC Worker End (ms): Min: 49600510.2, Avg: 49600510.3, Max: 49600510.4, Diff: 0.2]
[Code Root Fixup: 0.1 ms]
[Code Root Purge: 0.0 ms]
[Clear CT: 0.3 ms]
[Other: 1.7 ms]
[Choose CSet: 0.0 ms]
[Ref Proc: 1.2 ms]
[Ref Enq: 0.0 ms]
[Redirty Cards: 0.3 ms]
[Humongous Register: 0.0 ms]
[Humongous Reclaim: 0.0 ms]
[Free CSet: 0.0 ms]
[Eden: 1024.0K(587.0M)->0.0B(586.0M) Survivors: 16.0M->17.0M Heap: 261.4M(1006.0M)->263.0M(1006.0M)]
[Times: user=0.00 sys=0.00, real=0.01 secs]
2022-09-30T09:57:05.934+0800: 49600.513: [Full GC (Allocation Failure) 262M->97M(326M), 0.3911815 secs]
[Eden: 1024.0K(586.0M)->0.0B(190.0M) Survivors: 17.0M->0.0B Heap: 263.0M(1024.0M)->97.5M(326.0M)], [Metaspace: 117451K->117155K(1155072K)]
[Times: user=0.00 sys=0.00, real=0.39 secs]
2022-09-30T09:57:06.325+0800: 49600.905: [Full GC (Allocation Failure) 97M->95M(319M), 0.2844190 secs]
[Eden: 0.0B(190.0M)->0.0B(186.0M) Survivors: 0.0B->0.0B Heap: 97.5M(326.0M)->95.6M(319.0M)], [Metaspace: 117155K->117021K(1155072K)]
[Times: user=0.00 sys=0.00, real=0.28 secs]
2022-09-30T09:57:06.610+0800: 49601.189: [GC concurrent-mark-abort]
Heap
garbage-first heap total 326656K, used 122466K [0x00000000c0000000, 0x00000000c01009f8, 0x0000000100000000)
region size 1024K, 25 young (25600K), 0 survivors (0K)
Metaspace used 117146K, capacity 121418K, committed 122428K, reserved 1155072K
class space used 15173K, capacity 15988K, committed 16188K, reserved 1048576K
1122 阅读