JVM GC日志说明

本例jvm配置(jdk1.8)

-server -Xmx10m -Xms10m -XX:+DoEscapeAnalysis -XX:+PrintGCDetails 

gc日志

[GC (Allocation Failure) [PSYoungGen: 1592K->496K(2560K)] 1592K->504K(9728K), 0.0008324 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
[GC (Allocation Failure) [PSYoungGen: 496K->512K(2560K)] 504K->520K(9728K), 0.0012244 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
[Full GC (Allocation Failure) [PSYoungGen: 512K->0K(2560K)] [ParOldGen: 8K->393K(7168K)] 520K->393K(9728K), [Metaspace: 3140K->3140K(1056768K)], 0.0042845 secs] [Times: user=0.02 sys=0.00, real=0.01 secs] 
[GC (Allocation Failure) [PSYoungGen: 0K->0K(2560K)] 393K->393K(9728K), 0.0007836 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 
[Full GC (Allocation Failure) [PSYoungGen: 0K->0K(2560K)] [ParOldGen: 393K->376K(7168K)] 393K->376K(9728K), [Metaspace: 3140K->3140K(1056768K)], 0.0032492 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 

说明

例1:
[GC (Allocation Failure) [PSYoungGen: 1592K->496K(2560K)] 1592K->504K(9728K), 0.0008324 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]

  • GC (Allocation Failure):内存分配失败引发的gc
  • [PSYoungGen: 1592K->496K(2560K)] :年轻代gc,年轻代回收前堆占用 1592K,回收后占用 496K,年轻代堆大小2560K;
  • 1592K->504K(9728K):堆回收前占用1592K,回收后占用504K,总大小9728K
  • 0.0008324 secs:垃圾回收占用时间
  • [Times: user=0.00 sys=0.00, real=0.00 secs]

例2:
[Full GC (Allocation Failure) [PSYoungGen: 512K->0K(2560K)] [ParOldGen: 8K->393K(7168K)] 520K->393K(9728K), [Metaspace: 3140K->3140K(1056768K)], 0.0042845 secs] [Times: user=0.02 sys=0.00, real=0.01 secs]

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
	at WhileTrueTest.test(WhileTrueTest.java:21)
	at WhileTrueTest.main(WhileTrueTest.java:10)
Heap
 PSYoungGen      total 2560K, used 81K [0x00000007bfd00000, 0x00000007c0000000, 0x00000007c0000000)
  eden space 2048K, 3% used [0x00000007bfd00000,0x00000007bfd144d8,0x00000007bff00000)
  from space 512K, 0% used [0x00000007bff00000,0x00000007bff00000,0x00000007bff80000)
  to   space 512K, 0% used [0x00000007bff80000,0x00000007bff80000,0x00000007c0000000)
 ParOldGen       total 7168K, used 376K [0x00000007bf600000, 0x00000007bfd00000, 0x00000007bfd00000)
  object space 7168K, 5% used [0x00000007bf600000,0x00000007bf65e0c8,0x00000007bfd00000)
 Metaspace       used 3193K, capacity 4500K, committed 4864K, reserved 1056768K
  class space    used 351K, capacity 388K, committed 512K, reserved 1048576K

常见堆gc日志分析工具

GCViewer、GCEasy

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值