Java GC log的解读

Java的GC log中,往往有很多名称啊、数字啊,第一次看到时候,总会有点晕头转向的感觉。

今天又Google了一圈,找到两篇比较靠谱的网页记录一下:

  • HotSpot在PrintHeapAtGC输出的内容的格式
  • Java Garbage Collection Log messages

    引用一下stackoverflow上的那个例子
    8109.128: [GC [PSYoungGen: 109884K->14201K(139904K)] 691015K->595332K(1119040K), 0.0454530 secs]
    
    8112.111: [GC [PSYoungGen: 126649K->15528K(142336K)] 707780K->605892K(1121472K), 0.0934560 secs]
    
    8112.802: [GC [PSYoungGen: 130344K->3732K(118592K)] 720708K->607895K(1097728K), 0.0682690 secs]
    ->前后数字没有疑问,就是GC前后所对应区域的内存使用空间,一般GC分析时,关注这里就可以看出各代GC收集的效果了。但是后面还对应了一对小括号是干啥的?以上面的GC log中的第一行为例,那个(139904K)是神马的大小?
    这个参考上面撒迦的博文,就是里面所说的 Committed area ,这块区域通俗的讲就是JVM从OS那里已经申请到并且已经标记为自己占用的内存空间(尽管这块内存空间JVM自己可能并未分配给实际的Java对象)。
    再引用一下上面stackoverflow中一位兄台的回答如下:
     写道
    The next number in parentheses (e.g., (776768K) again from the first line) is the committed size of the heap: the amount of space usable for java objects without requesting more memory from the operating system. Note that this number does not include one of the survivor spaces, since only one can be used at any given time, and also does not include the permanent generation, which holds metadata used by the virtual machine.
     
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值