5

Is there a tool to analyze a large Java Heap dump (2GB), if one only can assign 1,5GB to the JVM? I can't believe the dump must be fully loaded into memory to be analyzed...

Eclipse MemoryAnalyzer fails, and the IBM tool also.

Do I need to use command line tools here now?

Daniel
  • 27,718
  • 20
  • 89
  • 133
  • 2
    Use a 64bit VM on a 64bit OS and give it enough memory. There's no other way that I know. – Joachim Sauer Jun 01 '11 at 10:52
  • 1
    YourKit is good at handling large dumps. I have used it with 8 GB dumps, but on a 64-bit machine. – Peter Lawrey Jun 01 '11 at 11:05
  • How can the heap dump get that big on a 32-bit JVM? Is it the extra non-heap allocation? – artbristol Jun 01 '11 at 11:10
  • @artbristol: The dump was created on a 64bit server VM, but my dev PC is 32bit. – Daniel Jun 01 '11 at 11:24
  • 1
    I have found in the past that a Linux disk can be your friend. No need to install the OS, just boot the OS from CD and have a Linux copy of MAT (Eclipse Memory Analyzer) sitting somewhere on your hard drive. Then you can analyze the dump file through that. – Sean Jun 01 '11 at 12:27
  • See also https://stackoverflow.com/questions/7254017/tool-for-analyzing-large-java-heap-dumps – rogerdpack Jul 19 '17 at 22:19

3 Answers3

3

One solution is to install the MAT tool on the remote server and generate an HTML output of the analysis to download and view locally. This saves the headache of attempting to get X Windows installed on the remote machine and get all of the ssh tunneling sorted out (which is of course an option as well).

First, download and install the stand-alone Eclipse RCP Application. Then transfer to your server and unpack. Then determine how large the heap dump is and, if necessary, modify the MemoryAnalyzer.ini file to instantiate a JVM with enough RAM for your heap dump.

In this example, I have an 11GB heap dump and have modified the last two lines (adding -Xms)

-startup
plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.300.v20150602-1417
-vmargs
-Xmx16g
-Xms16g

Do an initial run to parse the heap dump. This will generate intermediary data that can be used by subsequent runs to make future analysis faster.

./ParseHeapDump.sh /path/to/heap-dump

After that completes, you can run any of a number of different analysis on the data. The following is an illustration of how to search for memory leak suspects.

./ParseHeapDump.sh /path/to/heap-dump org.eclipse.mat.api:suspec
T-Bag
  • 10,916
  • 3
  • 54
  • 118
3

If it's a dev server, restrict the max heap size to something a 32-bit OS can handle. If it's in production, demand a 64-bit OS! If you can't get that, you can run jhat on the server (it has a web interface you can access on your own PC).

artbristol
  • 32,010
  • 5
  • 70
  • 103
0

Unfortunately Eclipse MAT and all heap dump analysis tools loads entire heap dump into memory in order to do the analysis. If Eclipse MAT fails for you, you may try HeapHero tool. JHAT take lore more memory and time than Eclipse MAT to analyze heap dumps.

Jim T
  • 101
  • 4