0

We noticed frequent Full GC entries in the GC log(for more than 3-4 hrs). Our XmX was 1.2g and all full GC's didn't recover much. VM stayed at around 1 g.

To see what is held in the heap, we took the heap dump but in Memory Analyzer Tool, we see only 30% occupied and remaining 70% free.

Heap file size is 1g though.

we used :live option to take the heap dump.

/usr/<java_version>/bin/jmap -dump:live,format=b,file=heap.bin <pid>

Is there any other way to get the complete snapshot of heap?

enrico.bacis
  • 30,497
  • 10
  • 86
  • 115
  • which application server is used? – Miki Aug 22 '14 at 09:09
  • @Miki we are using `tomcat` JDK 1.6 in RHEL(JVM runs in 32bit mode) – Bhaskar Na Aug 22 '14 at 12:41
  • Full GC can also be triggered to satisfy allocation in PermGen. Since you've recently asked about PermGen problems, I assume that's the case. – apangin Aug 22 '14 at 13:13
  • @apangin as I said, the heap size was full for almost 3-4 hours and Full GC logs were not indicating anything recovered. So, this problem is different from PermSpace. – Bhaskar Na Aug 23 '14 at 08:31
  • `jmap` gives you the most complete snapshot of the heap. There are also JVM options that you may find useful: `-XX:+PrintClassHistogramBeforeFullGC` `-XX:+PrintClassHistogramAfterFullGC` `-XX:+HeapDumpBeforeFullGC` `-XX:+HeapDumpAfterFullGC` `-XX:+HeapDumpOnOutOfMemoryError` – apangin Aug 24 '14 at 21:40
  • that require code change etc., i want to pull complete snapshot of currently running VM without restart in prod ..so any other JMAP options i should change so that i get the dump with full snapshot. – Bhaskar Na Aug 25 '14 at 07:35
  • 1. You can change these flags in run-time without restart. Connect to the JVM with JConsole and find `DiagnosticOptions` attribute of `com.sun.management:type=HotSpotDiagnostic` MBean. 2. `jmap -dump` without -live will take full snapshot. – apangin Aug 25 '14 at 08:47
  • Do i need to set these before running jmap -dump (without -live option) or i can use one of these 2 options? – Bhaskar Na Aug 25 '14 at 09:59
  • These are independent options. Use them in any order. – apangin Aug 25 '14 at 10:12
  • we haven't enabled the JMX option so, i cant try 1. I tried taking heap dump without Live option but no luck. Still i see pie chart in my MAT Tool for only 300m and 860m reminder. – Bhaskar Na Aug 25 '14 at 11:16
  • Either the heap is indeed not full, or you misinterpret the results which the tool shows. What does `jmap -histo ` says? – apangin Aug 25 '14 at 12:43
  • though heap dump file size is 1.1 g but in the MAT we don't see break up for all 1.1g. But jmap -histo pulls all. I could manage to get into the root cause with available heap dump itself. – Bhaskar Na Aug 27 '14 at 08:27

0 Answers0