eclipse内存分析器看到整个堆转储(8GB)的小部分(363,2MB) [英] eclipse memory analyzer sees small part (363,2MB) of entire heap dump (8GB)

查看:190
本文介绍了eclipse内存分析器看到整个堆转储(8GB)的小部分(363,2MB)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图调查 java.lang.OutOfMemoryError:超出GC限制,这发生在部署在tomcat中的web应用程序的高负载情况下。堆大小设置为8GB( -Xms2048m -Xmx8192m

在某个时间点,我们的应用程序变为无响应GC活动开销。我可以在日志中看到Full GC连续发生多次。所以我使用以下命令( jmap -F -dump:format = b,file = / root / dump2.hprof 4963 )执行了堆转储。包含转储的文件大小为9GB。转储完成后(应用程序被冻结约45分钟),多个完整的GC发生,直到引发 OutOfMemoryError 。这是GC活动的一个日志样本

  [Full GC [PSYoungGen:932096K-> 875513K(1864128K)] [ParOldGen: 5592447K-> 5592447K(5592448K)] 6524543K-> 6467961K(7456576K)[PSPermGen:112285K-> 112285K(262144K)],12.3954040秒] [时间:用户= 47.60 sys = 0.43,实际= 12.39秒] 
[Full GC [PSYoungGen:932096K-> 890562K(1864128K)] [ParOldGen:5592447K-> 5592447K(5592448K)] 6524543K-> 6483009K(7456576K)[PSPermGen:112285K-> 112285K(262144K)], [全部GC [PSYoungGen:932096K-> 895268K(1864128K)] [ParOldGen:5592447K-> 5592447K(5592448K)] 6524543K [12.6131900秒] [时间:用户= 48.45 sys = 0.49,实际= 12.61秒] - > 6487715K(7456576K)[PSPermGen:112285K-> 112285K(262144K)],12.9488670秒] [时间:用户= 49.61 sys = 0.46,实际= 12.95秒]


PSYoungGen总计1864128K,使用896698K [0 x0000000755560000,0x0000000800000000,0x0000000800000000)
eden space 932096K,96%used [0x0000000755560000,0x000000078c10e8a8,0x000000078e3a0000)
from space 932032K,0%used [0x000000078e3a0000,0x000000078e3a0000,0x00000007c71d0000)
to space 932032K,使用0%[0x00000007c71d0000,0x00000007c71d0000,0x0000000800000000)
ParOldGen总计5592448K,使用5592447K [0x0000000600000000,0x0000000755560000,0x0000000755560000)
对象空间5592448K,使用99%[0x0000000600000000,0x000000075555ff30,0x0000000755560000)
PSPermGen总计262144K,使用112285K [0x00000005e0000000,0x00000005f0000000,0x0000000600000000)
对象空间262144K,使用了42%[0x00000005e0000000,0x00000005e6da7530,0x00000005f0000000)

采集堆转储(约45分钟冻结)
[Full GC [PSYoungGen:932096K-> 903362K(1864128K)] [ParOldGen:5592447K-> 5592447K(5592448K)] 6524543K-> 6495810K(7456576K)[PSPermGen:112285K-> 112285K(262144K)],2883.986439 0秒] [时间:用户= 49.41 sys = 0.47,实际= 2884.17秒]
[Full GC [PSYoungGen:932096K-> 897728K(1864128K)] [ParOldGen:5592447K-> 5592444K(5592448K)] 6524543K - > 6490173K(7456576K)[PSPermGen:112288K-> 112288K(262144K)],13.3092680秒] [时间:用户= 50.75 sys = 0.40,实际= 13.31秒]

为了分析堆转储,我在eclipse内存分析器(MAT)中打开了它。不幸的是,MAT显示堆大小为363.2MB(在概览选项卡或堆转储详细信息选项卡中),而根据GC日志堆填充高达6467961K(6.4G)。无法到达的对象直方图总共显示75 511 736(75 MB)。直方图视图也证实了总浅堆是380 837 136(363.2MB)

我的问题是为什么如果GC无法回收内存,MAT不显示堆转储的所有对象?

  env详细信息:
Eclipse Memory Analyzer版本1.2.1
在$ b $上进行堆转储b Java版本1.7.0_13
Java™SE运行时环境(build 1.7.0_13-b20)
Java HotSpot™64位服务器虚拟机(构建23.7-b01,混合模式)

以下是MAT中导入堆转储的屏幕截图:






您可以通过转到首选项来启用该选项 - >内存分析器 - >保持无法访问的对象。一旦启用该选项,将再次加载堆。



一旦启用该选项,它将显示完整的堆。
即使我处于相同的情况,也无法获得更多的在线信息,我的经理向我展示了这个选项。希望它有帮助。


I was trying to investigate java.lang.OutOfMemoryError: GC limit exceeded which occurs at high load of our web app deployed in tomcat. Heap size was set to 8GB (-Xms2048m -Xmx8192m)

At some point in time our application become unresponsive due to GC activity overhead. I could see in logs that Full GC was occurring multiple times in a row. So I took heap dump with following command (jmap -F -dump:format=b,file=/root/dump2.hprof 4963). File containing dump was 9GB in size. After dump was taken (app was frozen for about 45minutes), multiple full GCs occured till OutOfMemoryError was thrown.

Here is a log sample of GC activity

[Full GC [PSYoungGen: 932096K->875513K(1864128K)] [ParOldGen: 5592447K->5592447K(5592448K)] 6524543K->6467961K(7456576K) [PSPermGen: 112285K->112285K(262144K)], 12.3954040 secs] [Times: user=47.60 sys=0.43, real=12.39 secs]
[Full GC [PSYoungGen: 932096K->890562K(1864128K)] [ParOldGen: 5592447K->5592447K(5592448K)] 6524543K->6483009K(7456576K) [PSPermGen: 112285K->112285K(262144K)], 12.6131900 secs] [Times: user=48.45 sys=0.49, real=12.61 secs]
[Full GC [PSYoungGen: 932096K->895268K(1864128K)] [ParOldGen: 5592447K->5592447K(5592448K)] 6524543K->6487715K(7456576K) [PSPermGen: 112285K->112285K(262144K)], 12.9488670 secs] [Times: user=49.61 sys=0.46, real=12.95 secs]

Heap
 PSYoungGen      total 1864128K, used 896698K [0x0000000755560000, 0x0000000800000000, 0x0000000800000000)
  eden space 932096K, 96% used [0x0000000755560000,0x000000078c10e8a8,0x000000078e3a0000)
  from space 932032K, 0% used [0x000000078e3a0000,0x000000078e3a0000,0x00000007c71d0000)
  to   space 932032K, 0% used [0x00000007c71d0000,0x00000007c71d0000,0x0000000800000000)
ParOldGen       total 5592448K, used 5592447K [0x0000000600000000, 0x0000000755560000, 0x0000000755560000)
  object space 5592448K, 99% used [0x0000000600000000,0x000000075555ff30,0x0000000755560000)
PSPermGen       total 262144K, used 112285K [0x00000005e0000000, 0x00000005f0000000, 0x0000000600000000)
  object space 262144K, 42% used [0x00000005e0000000,0x00000005e6da7530,0x00000005f0000000)

heap dump is taken (ca 45minutes freeze)
[Full GC [PSYoungGen: 932096K->903362K(1864128K)] [ParOldGen: 5592447K->5592447K(5592448K)] 6524543K->6495810K(7456576K) [PSPermGen: 112285K->112285K(262144K)], 2883.9864390 secs] [Times: user=49.41 sys=0.47, real=2884.17 secs]
[Full GC [PSYoungGen: 932096K->897728K(1864128K)] [ParOldGen: 5592447K->5592444K(5592448K)] 6524543K->6490173K(7456576K) [PSPermGen: 112288K->112288K(262144K)], 13.3092680 secs] [Times: user=50.75 sys=0.40, real=13.31 secs]

To analyze heap dump I opened it in eclipse memory analyzer (MAT). Unfortunately MAT displays that heap size was 363.2MB (in overview tab or heap dump details tab), whereas according to GC logs heap was filled up to 6467961K (6.4G). Unreachable Objects Histogram shows in total 75 511 736 (75 MB). Histogram view also confirmed that total shallow heap was 380 837 136 (363.2MB)

My question is why MAT doesn't display all objects from heap dump if GC cannot reclaim memory?

env details:
Eclipse Memory Analyzer Version 1.2.1
heap dump taken on
java version "1.7.0_13"
Java(TM) SE Runtime Environment (build 1.7.0_13-b20)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)

Here are screenshots of imported heap dump in MAT:

解决方案

MAT does not display the unreachable objects by default.

You can enable the option by going to Preferences -> Memory Analyzer -> Keep Unreachable Objects. Load the heap again once the option is enabled.

It will show the complete heap once the option is enabled. Even I was in same situation and was not able to get much information online and my manager showed me the option.Hope it helps.

这篇关于eclipse内存分析器看到整个堆转储(8GB)的小部分(363,2MB)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆