在我们看GC日志时,我们需要对垃圾回收器的工作流程比较熟悉,这样比较方便我们查看gc日志,大家可以看看我上一篇GC理论。
JVM启动参数:
-Xmn2M 年轻代分配2M
-Xmx6M 给java堆分配6M
-XX:+PrintGCDetails 打印GC详细信息
-XX:+PrintHeapAtGC 在GC发生之前与之后打印堆的详细信息
-XX:+PrintGCTimeStamps 允许在每个GC上打印时间戳。
-XX:+UseSerialGC 设置垃圾回收器serial+serialOld
-XX:+UseParNewGC 设置垃圾回收器parNew+cms
-XX:+UseParallelGC 设置垃圾回收器Parallel Scavenge+Parallel Old
-XX:+UseG1GC 设置垃圾回收期G1
-XX:+UseG1GC -Xloggc 设置日志存放位置

下面我们来看看每一种垃圾回收器的日志吧:

java代码主要做内存分配,根据不同的垃圾回收器查看不同的GC日志,由于日志太长了,这边我为了避免重复,参数只讲一遍,因为重复日志参数太多,只是值不同而已。我稍微省略一部分重复日志,避免日志过长。

public static void main(String[] args) throws Exception {Object[] objs= new Object[10];for(int i=1;i<=10;i++) {System.out.println("第"+i+"次分配");byte[] a = new byte[1*1024*1024];objs[i] = a;TimeUnit.SECONDS.sleep(1);}}

serial+serialOld收集器:-Xmn1m -Xmx3M -XX:+PrintGCDetails -XX:+PrintHeapAtGC -XX:+UseSerialGC -XX:+PrintCommandLineFlags

//设置运行参数
-XX:InitialHeapSize=3145728 -XX:MaxHeapSize=3145728 -XX:MaxNewSize=1048576 -XX:NewSize=1048576 -XX:+PrintCommandLineFlags -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintHeapAtGC -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:-UseLargePagesIndividualAllocation -XX:+UseSerialGC---------------开始------------
{Heap before GC invocations=0 (full 0):def new generation total 960K(年轻代总大小), used 896K (已使用大小)[0x00000000ffc00000, 0x00000000ffd00000, 0x00000000ffd00000)eden(eden区) space 896K, 100% used [0x00000000ffc00000, 0x00000000ffce0000, 0x00000000ffce0000)from (S0)space 64K,   0% used [0x00000000ffce0000, 0x00000000ffce0000, 0x00000000ffcf0000)to  (S1) space 64K,   0% used [0x00000000ffcf0000, 0x00000000ffcf0000, 0x00000000ffd00000)tenured generation  (老年代大小) total 3072K, used 0K (已使用空间) [0x00000000ffd00000, 0x0000000100000000, 0x0000000100000000)the space 3072K,   0% used [0x00000000ffd00000, 0x00000000ffd00000, 0x00000000ffd00200, 0x0000000100000000)Metaspace       used 2493K, capacity 4480K, committed 4480K, reserved 1056768Kclass space    used 273K, capacity 384K, committed 384K, reserved 1048576K
2021-07-29T15:37:01.497+0800: [GC (Allocation Failure) 2021-07-29T15:37:01.498+0800: [DefNew: 896K->63K(960K), 0.0039628 secs] 896K->548K(4032K), 0.0053424 secs] [Times: user=0.00 sys=0.00, real=0.01 secs]Heap after GC invocations=1 (调用GC次数)(full 0)(执行fullGC次数):def new generation   total 960K, used 63K [0x00000000ffc00000, 0x00000000ffd00000, 0x00000000ffd00000)eden space 896K,   0% used [0x00000000ffc00000, 0x00000000ffc00000, 0x00000000ffce0000)from space 64K,  99% used [0x00000000ffcf0000, 0x00000000ffcffff8, 0x00000000ffd00000)to   space 64K,   0% used [0x00000000ffce0000, 0x00000000ffce0000, 0x00000000ffcf0000)tenured generation   total 3072K, used 484K [0x00000000ffd00000, 0x0000000100000000, 0x0000000100000000)the space 3072K,  15% used [0x00000000ffd00000, 0x00000000ffd790a8, 0x00000000ffd79200, 0x0000000100000000)Metaspace       used 2493K, capacity 4480K, committed 4480K, reserved 1056768Kclass space    used 273K, capacity 384K, committed 384K, reserved 1048576K
}
------------结束before  + after 为一组GC-----------------{Heap before GC invocations=3 (full 1):def new generation   total 960K, used 0K [0x00000000ffc00000, 0x00000000ffd00000, 0x00000000ffd00000)eden space 896K,   0% used [0x00000000ffc00000, 0x00000000ffc00000, 0x00000000ffce0000)from space 64K,   0% used [0x00000000ffce0000, 0x00000000ffce0000, 0x00000000ffcf0000)to   space 64K,   0% used [0x00000000ffcf0000, 0x00000000ffcf0000, 0x00000000ffd00000)tenured generation   total 3072K, used 2838K [0x00000000ffd00000, 0x0000000100000000, 0x0000000100000000)the space 3072K,  92% used [0x00000000ffd00000, 0x00000000fffc5aa8, 0x00000000fffc5c00, 0x0000000100000000)Metaspace       used 3447K, capacity 4500K, committed 4864K, reserved 1056768Kclass space    used 375K, capacity 388K, committed 512K, reserved 1048576K
2021-07-29T15:37:01.678+0800: [Full GC (Allocation Failure) 2021-07-29T15:37:01.678+0800: [Tenured: 2838K->2792K(3072K), 0.0038622 secs] 2838K->2792K(4032K), [Metaspace: 3447K->3447K(1056768K)], 0.0039199 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
Heap after GC invocations=4 (full 2):def new generation   total 960K, used 0K [0x00000000ffc00000, 0x00000000ffd00000, 0x00000000ffd00000)eden space 896K,   0% used [0x00000000ffc00000, 0x00000000ffc00000, 0x00000000ffce0000)from space 64K,   0% used [0x00000000ffce0000, 0x00000000ffce0000, 0x00000000ffcf0000)to   space 64K,   0% used [0x00000000ffcf0000, 0x00000000ffcf0000, 0x00000000ffd00000)tenured generation   total 3072K, used 2792K [0x00000000ffd00000, 0x0000000100000000, 0x0000000100000000)the space 3072K,  90% used [0x00000000ffd00000, 0x00000000fffba160, 0x00000000fffba200, 0x0000000100000000)Metaspace       used 3447K, capacity 4500K, committed 4864K, reserved 1056768Kclass space    used 375K, capacity 388K, committed 512K, reserved 1048576K
}
Exception in thread "main" java.lang.OutOfMemoryError: Java heap spaceat com.mimaxueyuan.jvm.gc.SerialGCDemo.alloc1(SerialGCDemo.java:28)at com.mimaxueyuan.jvm.gc.SerialGCDemo.main(SerialGCDemo.java:43)
Heapdef new generation   total 960K, used 44K [0x00000000ffc00000, 0x00000000ffd00000, 0x00000000ffd00000)eden space 896K,   4% used [0x00000000ffc00000, 0x00000000ffc0b040, 0x00000000ffce0000)from space 64K,   0% used [0x00000000ffce0000, 0x00000000ffce0000, 0x00000000ffcf0000)to   space 64K,   0% used [0x00000000ffcf0000, 0x00000000ffcf0000, 0x00000000ffd00000)tenured generation   total 3072K, used 2792K [0x00000000ffd00000, 0x0000000100000000, 0x0000000100000000)the space 3072K,  90% used [0x00000000ffd00000, 0x00000000fffba160, 0x00000000fffba200, 0x0000000100000000)Metaspace       used 3480K, capacity 4500K, committed 4864K, reserved 1056768Kclass space    used 379K, capacity 388K, committed 512K, reserved 1048576K

主要还是查看最后内存溢出的原因,java.lang.OutOfMemoryError,因为我设置的为最大堆内存为3M,在第4次存储时,由于java堆内存不够所以导致内存溢java.lang.OutOfMemoryError,可以看老年代的内存空间已不够用了 tenured generation total 3072K, used 2792K 。总大小3072K,已使用 2792K。第四次时就会抛出内存溢出。

parNew收集器:-Xmn2m -Xmx6M -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintHeapAtGC -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+PrintCommandLineFlags

{Heap before GC invocations=1 (full 0):par new generation   total 1856K(年轻代大小), used 1856K (已使用大小)[0x00000000ffa00000, 0x00000000ffc00000, 0x00000000ffc00000)eden space 1664K, 100% used [0x00000000ffa00000, 0x00000000ffba0000, 0x00000000ffba0000)from space 192K, 100% used [0x00000000ffbd0000, 0x00000000ffc00000, 0x00000000ffc00000)to   space 192K,   0% used [0x00000000ffba0000, 0x00000000ffba0000, 0x00000000ffbd0000)concurrent mark-sweep generation total 4096K(老年代大小), used 514K (已使用大小)[0x00000000ffc00000, 0x0000000100000000, 0x0000000100000000)Metaspace       used 3604K, capacity 4506K, committed 4864K, reserved 1056768Kclass space    used 392K, capacity 394K, committed 512K, reserved 1048576K
2021-07-29T12:56:39.595+0800: [GC (Allocation Failure) 2021-07-29T12:56:39.595+0800: [ParNew: 1856K->188K(1856K), 0.0013330 secs] 2370K->1923K(5952K), 0.0013825 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] Heap after GC invocations=2 (full 0):par new generation   total 1856K, used 188K [0x00000000ffa00000, 0x00000000ffc00000, 0x00000000ffc00000)eden space 1664K,   0% used [0x00000000ffa00000, 0x00000000ffa00000, 0x00000000ffba0000)from space 192K,  97% used [0x00000000ffba0000, 0x00000000ffbcf010, 0x00000000ffbd0000)to   space 192K,   0% used [0x00000000ffbd0000, 0x00000000ffbd0000, 0x00000000ffc00000)concurrent mark-sweep generation total 4096K, used 1735K [0x00000000ffc00000, 0x0000000100000000, 0x0000000100000000)Metaspace       used 3604K, capacity 4506K, committed 4864K, reserved 1056768Kclass space    used 392K, capacity 394K, committed 512K, reserved 1048576K
}{Heap before GC invocations=3 (full 0):par new generation   total 1856K, used 1235K [0x00000000ffa00000, 0x00000000ffc00000, 0x00000000ffc00000)eden space 1664K,  62% used [0x00000000ffa00000, 0x00000000ffb04e98, 0x00000000ffba0000)from space 192K, 100% used [0x00000000ffbd0000, 0x00000000ffc00000, 0x00000000ffc00000)to   space 192K,   0% used [0x00000000ffba0000, 0x00000000ffba0000, 0x00000000ffbd0000)concurrent mark-sweep generation total 4096K, used 1954K [0x00000000ffc00000, 0x0000000100000000, 0x0000000100000000)Metaspace       used 3972K, capacity 4572K, committed 4864K, reserved 1056768Kclass space    used 439K, capacity 460K, committed 512K, reserved 1048576K
2021-07-29T12:56:41.018+0800: [GC (Allocation Failure) 2021-07-29T12:56:41.018+0800: [ParNew: 1235K->0K(1856K), 0.0019351 secs] 3190K->3170K(5952K), 0.0020350 secs] [Times: user=0.05 sys=0.00, real=0.00 secs] Heap after GC invocations=4 (full 0):par new generation   total 1856K, used 0K [0x00000000ffa00000, 0x00000000ffc00000, 0x00000000ffc00000)eden space 1664K,   0% used [0x00000000ffa00000, 0x00000000ffa00000, 0x00000000ffba0000)from space 192K,   0% used [0x00000000ffba0000, 0x00000000ffba0000, 0x00000000ffbd0000)to   space 192K,   0% used [0x00000000ffbd0000, 0x00000000ffbd0000, 0x00000000ffc00000)concurrent mark-sweep generation total 4096K, used 3170K [0x00000000ffc00000, 0x0000000100000000, 0x0000000100000000)Metaspace       used 3972K, capacity 4572K, committed 4864K, reserved 1056768Kclass space    used 439K, capacity 460K, committed 512K, reserved 1048576K
}
2021-07-29T12:56:41.020+0800: [GC (CMS Initial Mark(初始化标记)) [1 CMS-initial-mark: 3170K(4096K)] 4194K(5952K), 0.0002840 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
2021-07-29T12:56:41.021+0800: [CMS-concurrent-mark-start(并发标记启动,使用可达分析)]
2021-07-29T12:56:41.023+0800: [CMS-concurrent-mark(并发标记耗时): 0.002/0.002 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
2021-07-29T12:56:41.023+0800: [CMS-concurrent-preclean-start((最终标记)虚拟机查找在上一步"并发标记阶段"(Concurrent Mark)时进入老年代的对象。通过重新扫描,减少后面的阶段五"Final Remark"的工作)]
2021-07-29T12:56:41.023+0800: [CMS-concurrent-preclean: 0.000/0.000 secs(同步清理结束)] [Times: user=0.00 sys=0.00, real=0.00 secs] 2021-07-29T12:56:41.023+0800: [GC (CMS Final Remark) [YG occupancy: 1024 K (1856 K)]2021-07-29T12:56:41.023+0800: [Rescan (parallel) , 0.0001370 secs]2021-07-29T12:56:41.023+0800: [weak refs processing, 0.0000462 secs]2021-07-29T12:56:41.023+0800: [class unloading, 0.0003920 secs]2021-07-29T12:56:41.024+0800: [scrub symbol table, 0.0007534 secs]2021-07-29T12:56:41.024+0800: [scrub string table, 0.0002347 secs][1 CMS-remark: 3170K(4096K)] 4194K(5952K), 0.0016931 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
2021-07-29T12:56:41.025+0800: [CMS-concurrent-sweep-start(CMS并发清理启动)]
2021-07-29T12:56:41.025+0800: [CMS-concurrent-sweep: 0.001/0.001 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
2021-07-29T12:56:41.025+0800: [CMS-concurrent- -start(CMS并发重置启动)]
2021-07-29T12:56:41.025+0800: [CMS-concurrent-reset: 0.000/0.000 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] Heap after GC invocations=6 (full 3):par new generation   total 1856K, used 1024K [0x00000000ffa00000, 0x00000000ffc00000, 0x00000000ffc00000)eden space 1664K,  61% used [0x00000000ffa00000, 0x00000000ffb00010, 0x00000000ffba0000)from space 192K,   0% used [0x00000000ffba0000, 0x00000000ffba0000, 0x00000000ffbd0000)to   space 192K,   0% used [0x00000000ffbd0000, 0x00000000ffbd0000, 0x00000000ffc00000)concurrent mark-sweep generation total 4096K, used 3085K [0x00000000ffc00000, 0x0000000100000000, 0x0000000100000000)Metaspace       used 3972K, capacity 4572K, committed 4864K, reserved 1056768Kclass space    used 439K, capacity 460K, committed 512K, reserved 1048576K
}
2021-07-29T12:56:42.031+0800: [GC (CMS Initial Mark(初始化标记)) [1 CMS-initial-mark: 3085K(4096K)] 4109K(5952K), 0.0002590 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
2021-07-29T12:56:42.032+0800: [CMS-concurrent-mark-start(并发标记启动)]
Exception in thread "main" java.lang.OutOfMemoryError: Java heap spaceat com.mimaxueyuan.jvm.gc.ParNewDemo.main(ParNewDemo.java:45)
2021-07-29T12:56:42.033+0800: [CMS-concurrent-mark(并发标记耗时): 0.002/0.002 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
2021-07-29T12:56:42.033+0800: [CMS-concurrent-preclean-start(最终标记)]
Heappar new generation   total 1856K, used 1118K [0x00000000ffa00000, 0x00000000ffc00000, 0x00000000ffc00000)eden space 1664K,  67% used [0x00000000ffa00000, 0x00000000ffb17848, 0x00000000ffba0000)from space 192K,   0% used [0x00000000ffba0000, 0x00000000ffba0000, 0x00000000ffbd0000)to   space 192K,   0% used [0x00000000ffbd0000, 0x00000000ffbd0000, 0x00000000ffc00000)concurrent mark-sweep generation total 4096K, used 3085K [0x00000000ffc00000, 0x0000000100000000, 0x0000000100000000)Metaspace       used 4003K, capacity 4572K, committed 4864K, reserved 1056768Kclass space    used 443K, capacity 460K, committed 512K, reserved 1048576K

这些基本日志参数差不多基本一致,主要看它垃圾回收模式不同,parNew的老年代回收主要采用的是CMS工作模式。

Parallel+Parallel Old收集器:-Xmn2m -Xmx6M -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintHeapAtGC -XX:+UseParallelOldGC -XX:+PrintCommandLineFlags

{Heap before GC invocations=1 (full 0):PSYoungGen      total 1536K(年轻代大小), used 1019K(已使用大小) [0x00000000ffe00000, 0x0000000100000000, 0x0000000100000000)eden space 1024K, 99% used [0x00000000ffe00000,0x00000000ffefee20,0x00000000fff00000)from space 512K, 0% used [0x00000000fff80000,0x00000000fff80000,0x0000000100000000)to   space 512K, 0% used [0x00000000fff00000,0x00000000fff00000,0x00000000fff80000)ParOldGen       total 4096K (老年代大小), used 0K (已使用大小)[0x00000000ffa00000, 0x00000000ffe00000, 0x00000000ffe00000)object space 4096K, 0% used [0x00000000ffa00000,0x00000000ffa00000,0x00000000ffe00000)Metaspace       used 2513K, capacity 4480K, committed 4480K, reserved 1056768Kclass space    used 274K, capacity 384K, committed 384K, reserved 1048576K
2021-07-29T13:30:12.524+0800: [GC (Allocation Failure) [PSYoungGen: 1019K->488K(1536K)] 1019K->648K(5632K), 0.0016275 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
Heap after GC invocations=1 (full 0):PSYoungGen      total 1536K, used 488K [0x00000000ffe00000, 0x0000000100000000, 0x0000000100000000)eden space 1024K, 0% used [0x00000000ffe00000,0x00000000ffe00000,0x00000000fff00000)from space 512K, 95% used [0x00000000fff00000,0x00000000fff7a020,0x00000000fff80000)to   space 512K, 0% used [0x00000000fff80000,0x00000000fff80000,0x0000000100000000)ParOldGen       total 4096K, used 160K [0x00000000ffa00000, 0x00000000ffe00000, 0x00000000ffe00000)object space 4096K, 3% used [0x00000000ffa00000,0x00000000ffa28000,0x00000000ffe00000)Metaspace       used 2513K, capacity 4480K, committed 4480K, reserved 1056768Kclass space    used 274K, capacity 384K, committed 384K, reserved 1048576K
}{Heap before GC invocations=7 (full 2):PSYoungGen      total 1536K, used 0K [0x00000000ffe00000, 0x0000000100000000, 0x0000000100000000)eden space 1024K, 0% used [0x00000000ffe00000,0x00000000ffe00000,0x00000000fff00000)from space 512K, 0% used [0x00000000fff00000,0x00000000fff00000,0x00000000fff80000)to   space 512K, 0% used [0x00000000fff80000,0x00000000fff80000,0x0000000100000000)ParOldGen       total 4096K, used 2810K [0x00000000ffa00000, 0x00000000ffe00000, 0x00000000ffe00000)object space 4096K, 68% used [0x00000000ffa00000,0x00000000ffcbe9d0,0x00000000ffe00000)Metaspace       used 3448K, capacity 4500K, committed 4864K, reserved 1056768Kclass space    used 375K, capacity 388K, committed 512K, reserved 1048576K
2021-07-29T13:30:12.654+0800: [Full GC (Allocation Failure) [PSYoungGen: 0K->0K(1536K)] [ParOldGen: 2810K->2791K(4096K)] 2810K->2791K(5632K), [Metaspace: 3448K->3448K(1056768K)], 0.0107902 secs] [Times: user=0.03 sys=0.00, real=0.01 secs]
Heap after GC invocations=7 (full 2):PSYoungGen      total 1536K, used 0K [0x00000000ffe00000, 0x0000000100000000, 0x0000000100000000)eden space 1024K, 0% used [0x00000000ffe00000,0x00000000ffe00000,0x00000000fff00000)from space 512K, 0% used [0x00000000fff00000,0x00000000fff00000,0x00000000fff80000)to   space 512K, 0% used [0x00000000fff80000,0x00000000fff80000,0x0000000100000000)ParOldGen       total 4096K, used 2791K [0x00000000ffa00000, 0x00000000ffe00000, 0x00000000ffe00000)object space 4096K, 68% used [0x00000000ffa00000,0x00000000ffcb9fd8,0x00000000ffe00000)Metaspace       used 3448K, capacity 4500K, committed 4864K, reserved 1056768Kclass space    used 375K, capacity 388K, committed 512K, reserved 1048576K
}
Exception in thread "main" java.lang.OutOfMemoryError: Java heap spaceat com.mimaxueyuan.jvm.gc.ParallelGCDemo.alloc1(ParallelGCDemo.java:28)at com.mimaxueyuan.jvm.gc.ParallelGCDemo.main(ParallelGCDemo.java:43)
HeapPSYoungGen      total 1536K, used 47K [0x00000000ffe00000, 0x0000000100000000, 0x0000000100000000)eden space 1024K, 4% used [0x00000000ffe00000,0x00000000ffe0bfc0,0x00000000fff00000)from space 512K, 0% used [0x00000000fff00000,0x00000000fff00000,0x00000000fff80000)to   space 512K, 0% used [0x00000000fff80000,0x00000000fff80000,0x0000000100000000)ParOldGen       total 4096K, used 2791K [0x00000000ffa00000, 0x00000000ffe00000, 0x00000000ffe00000)object space 4096K, 68% used [0x00000000ffa00000,0x00000000ffcb9fd8,0x00000000ffe00000)Metaspace       used 3480K, capacity 4500K, committed 4864K, reserved 1056768Kclass space    used 379K, capacity 388K, committed 512K, reserved 1048576K

主要还是看他们使用的内存以及内存溢出情况。

G1收集器:-Xmn2M -Xmx6M -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintHeapAtGC -XX:+UseG1GC -Xloggc:C:\gc日志\gc.log


{Heap before GC invocations=0 (full 0):garbage-first heap   total 6144K(java堆总大小), used 3072K(使用大小) [0x00000000ffa00000, 0x00000000ffb00030, 0x0000000100000000)region size 1024K(每个region大小), 3 young (3072K)(3个年轻代大小 3072k,一个1024), 0 survivors (0K) (幸存区大小)Metaspace       used 3448K, capacity 4500K, committed 4864K, reserved 1056768Kclass space    used 375K, capacity 388K, committed 512K, reserved 1048576K
2021-07-29T13:31:39.515+0800: [GC pause (G1 Humongous Allocation) (young) (initial-mark), 0.0023577 secs][Parallel Time: 2.0 ms, GC Workers: 4] (GC并行时间,GC线程数)[GC Worker Start (ms): Min: 695.7, Avg: 695.7, Max: 695.7, Diff: 0.0] (线程启动时间,最小,平均时间,最大时间,差异值)[Ext Root Scanning (ms): Min: 0.6, Avg: 0.7, Max: 0.8, Diff: 0.2, Sum: 2.9](扫描根(全局,寄存器,线程栈)花费的时间)[Update RS (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0](跟新rset需要的时间)[Processed Buffers: Min: 0, Avg: 0.0, Max: 0, Diff: 0, Sum: 0][Scan RS (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0](扫描rset花费的时间)[Code Root Scanning (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0](代码根扫描的时间)[Object Copy (ms): Min: 1.0, Avg: 1.1, Max: 1.2, Diff: 0.2, Sum: 4.3](对象copy时间,将对象copy到新的分区)[Termination (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0](每一个线程中断花费的时间)[Termination Attempts: Min: 1, Avg: 1.3, Max: 2, Diff: 1, Sum: 5](每个线程中断的次数)[GC Worker Other (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.0, Sum: 0.3](其它线程花费的时间)[GC Worker Total (ms): Min: 1.9, Avg: 1.9, Max: 1.9, Diff: 0.0, Sum: 7.5](总线程花费时间)[GC Worker End (ms): Min: 697.6, Avg: 697.6, Max: 697.6, Diff: 0.0](线程结束花费的时间)[Code Root Fixup: 0.0 ms](修复gc code root花费的时间)[Code Root Purge: 0.0 ms](消除code root 花费的时间)[Clear CT: 0.1 ms](清除card tables 中dirty card)花费的时间[Other: 0.3 ms](其它耗时)[Choose CSet: 0.0 ms](选择cset)[Ref Proc: 0.1 ms][Ref Enq: 0.0 ms][Redirty Cards: 0.1 ms][Humong ous Register: 0.0 ms](humong大对象分区注册时间)[Humongous Reclaim: 0.0 ms][Free CSet: 0.0 ms][Eden: 3072.0K(3072.0K)->0.0B(1024.0K)(Eden区从3072变为0) Survivors: 0.0B->1024.0K (Survivors区从0变为1024) Heap: 3247.1K(6144.0K)(堆大小变化同上)->1856.1K(6144.0K)]
Heap after GC invocations=1 (full 0):garbage-first heap   total 6144K, used 1856K [0x00000000ffa00000, 0x00000000ffb00030, 0x0000000100000000)region size 1024K, 1 young (1024K), 1 survivors (1024K)Metaspace       used 3448K, capacity 4500K, committed 4864K, reserved 1056768Kclass space    used 375K, capacity 388K, committed 512K, reserved 1048576K
}

大家还是需要先了解垃圾收集器工作模式再去看日志会比较舒服吧,这篇博客主要是在工作中帮助我们排查一些内存溢出的问题了。

JVM GC日志解析相关推荐

  1. java 程序执行后 强制gc_【GC系列】JVM的常用GC参数及GC日志解析

    今天继续GC系列第三篇,熬夜不易,欢迎一键三连,给个鼓励,不点赞也没关系,我还可以,谢谢捧场[捂脸]. 常见垃圾回收器组合设定 在oracle官网上可以看到如何开启使用指定垃圾回收的命令: https ...

  2. Java GC 日志解析

    JVM 在Java应用程序优化中是不可缺少的一大重项,如何合理配置Java参数,如果验证配置参数的有效性,从GC日志中可以获得很重要的提示,以下是笔者对GC垃圾收集器默认开启的组合日志的部分的解析,希 ...

  3. JVM:GC日志解读

    深入理解Java虚拟机 [JVM]Java内存区域与垃圾收集 - 思维导图 [JVM]类加载机制 - 思维导图 [JVM]OOM实例分析 [JVM]理解Class文件(1):手动解析常量池 [JVM] ...

  4. JVM GC 日志详解

    本文采用的JDK版本: java version "1.8.0_144" Java(TM) SE Runtime Environment (build 1.8.0_144-b01) ...

  5. linux 输出gc日志,Tomcat输出保存JVM GC日志文件

    当系统出现问题时,分析java虚拟机GC日志可以帮助我们定位问题,一般来说, 我们可以通过制定JVM参数使tomcat保存GC日志文件,具体实现如下: Windows下 找到tomcat的解压目录,进 ...

  6. JVM GC日志说明

    本例jvm配置(jdk1.8) -server -Xmx10m -Xms10m -XX:+DoEscapeAnalysis -XX:+PrintGCDetails gc日志 [GC (Allocati ...

  7. JVM GC日志详细分析,ParallelGC和G1

    一.默认垃圾回收器:ParallelGC jvm启动参数: -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp/heapdump.hprof - ...

  8. JVM GC日志分析

    常用JVM参数 http://blog.csdn.net/gzh0222/article/details/8223277  分析gc日志后,经常需要调整jvm内存相关参数,常用参数如下 -Xms:初始 ...

  9. JVM GC原理解析

    JVM GC原理 1.JVM 的内存空间,从大的层面上来分析包含:新生代空间和老年代空间. 新生代空间又被分为2各部分(Eden区域.Survious区域) 和3个板块(1个Eden区域和2个Surv ...

最新文章

  1. 自作的WM文件浏览器
  2. 一次毕生难忘的 Java 内存泄漏排查经历
  3. python 归并排序,合并有序数组,逆序对个数
  4. 在.NET Core 中使用Quartz.NET
  5. python模块;opencv安装
  6. Ubuntu环境搭建三:VIM配置
  7. python 查找IP地址归属地
  8. Windows Phone 8.1中AppBarToggleButton的绑定问题
  9. 高质量C/C++编程指南
  10. 想练字要怎么选择字体?
  11. 全国、省、地级市、区县乡镇级矢量地图2021年(最新)
  12. 大学计算机试题深圳大学,深圳大学期末考试试卷参考答案.doc
  13. Prolog编程求解图搜索问题
  14. 基于STM32的物联网健康监测系统设计(附源码)
  15. Dism 错误 32
  16. 平台搭建_记一次CTFd平台搭建
  17. ubuntu18.04 快速搭建 Hyperledger Fabric超级账本框架
  18. 【BlockingQueue】BlockingQueue接口方法说明和区别
  19. Android 安全分析和漏洞挖掘|工具集
  20. 如何选择可转债?可转债是否能带来暴利?

热门文章

  1. web专项测试之兼容性测试
  2. mysql smallint 长度_转:mysql中int、bigint、smallint 和 tinyint的区别与长度的含义
  3. 实名认证在文旅出行行业的应用场景有哪些?
  4. 2021年中国电池片产量及重点企业对比分析(正泰电器VS明阳智能VS晶澳科技VS中来股份VS林洋能源)[图]
  5. 计算机网络——计算机网络体系结构
  6. 华为交换机镜像口配置
  7. Container 详解
  8. Linux SSH与SCP的配置
  9. 2022年全球市场病毒清除服务总体规模、主要企业、主要地区、产品和应用细分研究报告
  10. Factorial B