JVM GC日志参数
案例:
2021-03-25T13:00:41.631+0800: 4.013: [GC (Allocation Failure) [PSYoungGen: 419840K->20541K(472064K)] 419840K->20573K(996352K), 0.0118345 secs] [Times: user=0.00 sys=0.00, real=0.01 secs]
详细内容如下:
- 2021-03-25T13:00:41.631+0800:GC发生的时间点。
- 4.013:系统运行多久之后发生的GC,单位秒,这里就是系统运行 4.013 秒后发生了一次GC。
- GC (Allocation Failure):说明了触发GC的原因,这里是指对象分配失败导致的GC。
- PSYoungGen:指触发的是年轻代的垃圾回收,使用的是 Parallel Scavenge 垃圾回收器。
- 419840K->20541K:对年轻代执行了一次GC,GC之前年轻代使用了 419840K,GC之后有 20541K 的对象活下来了。
- (472064K):年轻代可用空间是 472064K,即 461 M,为什么是461M呢?因为新生代大小为 512M,Eden 区占 409.6M,两块 Survivor 区各占 51.2M,所以年轻代的可用空间为 Eden+1个Survivor的大小,即460.8M,约为461M。
- 419840K->20573K:GC前整个堆内存使用了 419840K,GC之后堆内存使用了 20573K。
- (996352K):整个堆的大小是 996352K,即 973M,其实就是年轻代的 461M + 老年代的 512 M
- 0.0118345 secs:本次GC耗费的时间
- Times: user=0.00 sys=0.00, real=0.01 secs:本次GC耗费的时间
Heap
PSYoungGen total 472064K, used 406352K [0x00000000e0000000, 0x0000000100000000, 0x0000000100000000)
eden space 419840K, 93% used [0x00000000e0000000,0x00000000f7f00528,0x00000000f9a00000)
from space 52224K, 27% used [0x00000000f9a00000,0x00000000fa7d3d70,0x00000000fcd00000)
to space 52224K, 0% used [0x00000000fcd00000,0x00000000fcd00000,0x0000000100000000)
ParOldGen total 524288K, used 189923K [0x00000000c0000000, 0x00000000e0000000, 0x00000000e0000000)
object space 524288K, 36% used [0x00000000c0000000,0x00000000cb978d08,0x00000000e0000000)
Metaspace used 111852K, capacity 117676K, committed 117888K, reserved 1153024K
class space used 13876K, capacity 14914K, committed 14976K, reserved 1048576K
详细内容如下:
- PSYoungGen total 472064K, used 406352K:指 Parallel Scavenge 回收器负责的年轻代总共有 472064K(461M)内存,目前使用了 406352K (396.8M)。
- eden space 419840K, 93% used:Eden 区的空间为 419840K(410M),已经使用了 93%。
- from space 52224K, 27% used:From Survivor 区的空间为 52224K(51M),已经使用了 27%。
- to space 52224K, 0% used:To Survivor 区的空间为 52224K(51M),使用了 0%,就是完全空闲的。
- ParOldGen total 524288K, used 189923K:指 Parallel Old 回收器负责的老年代总共有 524288K(512M),目前使用了 189923K(185.4M)。
- object space 524288K, 36% used:老年代空间总大小 524288K(512M),使用了 36%。
- Metaspace & class space:Metaspace 元数据空间和Class空间,总容量、使用的内存等。