Convert IBM .phdfile to .hprof heap dump format - java

I am trying to analyse a dump file from a websphere production machine, at the moment I am not succesfull because the file is of the type .phd, and well things would be alot easier when the file could be converted to .hprof

It is not generally possible to convert a PHD to HProf format. Have you tried using Eclipse MAT?

For PHD dumps use JProbe (see http://www.quest.com/jprobe), where you can import IBM PHD Dump files and analyze them. JProbe is a really powerful and easy to use tool for java profiling.
You can also use JProbe plug-in for Eclipse if you like Eclipse environment.
Regards, Lukas.

Related

analyse a HPROF memory dump file from command line programmatically

I was investigation with analyzing a HPROF file using Eclipse's Memory Analyser (MAT).
The dominator tree, reports and the OQL interface look really useful. But all this has to be done manually from the MAT software.
Is there a commandline interface so I can programmatically parse the HPROF and automatically generate custom reports.
This would be useful to integrate this a test infrastructure to do a automatic memory analysis.
Btw, the heapsize is will be between 10-60MB.
ParseHeapDump.sh does what you're looking for. As for the follow up question I'm not sure what format the index files are stored in.
See bitbucket.org/joebowbeer/andromat, which is adapted from bitbucket.org/ekabanov/mat, which is a stripped-down command line version of Eclipse Memory Analyzer.

Viewing live heap in Eclipse

Is it possible to see the heap of a program in eclipse itself while it is executing? Is there a plugin for that?
I don't know if there is an Eclipse plugin, but if what matters is getting the information and not necessarily through Eclipse then you can do that with JVisualVM, and there are several plugins that provide all the details that you want.
One of its features is that you can make a heap dump.
Documentation says:
Take and browse heap dumps. When you need to browse contents of application memory or uncover a memory leak in your application,
you'll find the built-in HeapWalker tool really handy. It can read
files written in hprof format and is also able to browse heap dumps
created by the JVM on an OutOfMemoryException.
Eclipse does have a plugin called Eclipse Memory Analyzer (MAT). You can check it out here. I heard it is quite handy for heap analysis and fixing memory leaks in your program.
http://www.eclipse.org/mat/

How to read heap dump file which is created by jconsole?

I performed a heap dump manually by invoking the com.sun.management.HotSpotDiagnostic MXBean's dumpHeap operation in jconsole. So I got a dump file.
My question:
Can jconsole read the dump file? If not, which tool can read it? Thanks!
EDIT: Now I know jconsole doesn't provide read feature, I am wondering reason why jconsole only writes dump file without read feature. (This is not my question, I am just curoius about it)
I found an Eclipse plugin Memory Analyzer to read the dump file by myself. Other tools are still welcome.
You can use jvisualvm.exe which comes with JDK 1.5 and above. Its present in bin folder of JDK. This is a very good tool which can be used to profile even the running Java applications.
You can even use JProfiler to read heap dump files. But this software is licensed.

jmap/jhat vs jVisualVM

I understand that jmap is used to create heap dumps and the same can be analysed by Jhat.
jVisualVM also can be used to analyze the heap dumps (and can do much more tasks such as profiling etc).
But what is the difference between analyzing heap dumps using jHat and visualVM (other than one if using Web and second is desktop). What Sun is providing different tools and which one is better?
PS: I have limited understanding of these tools as I have worked on limited profiling/analysis tools such as JProbe, Java Heap Dump Analyzer, etc. Please correct if my understanding is wrong somewhere.
jmap and jhat are the core tools with command line interface. VisualVM is a visual workbench integrating command line tools to manage things more easily without having to work through the command line options. If you know and free comfortable working with command line tools then go with them. VisualVM doesnt do anything extra but provides a good visual interface for a better user experience. I believe it internally uses jmap/jhat.
The difference is analogous to the difference between a graphical debugger and a commandline debugger. It is often easier to work in a visual mode.

How do I analyze a .mdmp file?

I have java application that is crashing while in production. It doesn't do so in dev/QA. The jvm is creating a .mdmp file and a text file. How do I analyze the binary dump file? I googled but had no luck. We are using bea jrockit jvm 1.5 R27.
The .mdmp file is a Windows MiniDump file that you can only read with a debugger (like WinDbg). Typically you need the sources of the crashed application to really get some information out of the dump. So in your case you can't do much but contacting JRockit support.
Here a link to the Orace JRockit information about JVM crahes.
.mdmp files are the Windows equivalent of unix/linux core dumps. You can analyse them with WinDBG but if it's a Java process that has crashed most likely you'll want to use Java's own tools to analyse the crashed process.
If you want to look at the heap of the crashed Java process you can use a tool that ships with the JDK called jmap to extract a HPROF file from a .core or .mdmp and then load this into a memory analyser. Note also that some memory analyzers can load core dumps and Windows minidumps directly.
Related issue and the jmap docs
If you want to see the state of the threads then you can use a tool called jstack to print stack traces for every thread at the point the dump was created. jstack docs.

Categories

Resources