views:

8952

answers:

9

If i make java core dump with gcore then what is the best tool to analyze it? I need to be able make jmap, jstack, jstat etc and also i need to see values of all variables.

Something that can take core dump as frozen JVM.

A: 

IBM provide a number of tools which can be used on the sun jvm as well. Take a look at some of the projects on alphaworks, they provide a heap and thread dump analyzers

Karl

Karl
+2  A: 

Maybe VisualVM can help (haven't yet had a chance to try it myself). Link:

http://java.sun.com/javase/6/docs/technotes/guides/visualvm/coredumps.html

brianmarco
A: 

I recommend you to try Netbeans Profiler.It has rich set of tools for real time analysis. Tools from IbM are worth a try for offline analysis

+2  A: 

Are you sure a core dump is what you want here? That will contain the raw guts of the running JVM, rather than java-level information. Perhaps a JVM heap dump is more what you need.

skaffman
A: 

gdb

\\wbr Vitaly

vitaly.v.ch
+2  A: 

Okay if you've created the core dump with gcore or gdb then you'll need to convert it to something called a HPROF file. These can be used by VisualVM, Netbeans or Eclipse's Memory Analyzer Tool (formerly SAP Memory Analyzer). I'd recommend Eclipse MAT.

To convert the file use the commandline tool jmap.

# jmap -dump:format=b,file=dump.hprof /usr/bin/java core.1234

where:

dump.hprof is the name of the hprof file you wish to create

/usr/bin/java is the path to the version of the java binary that generated the core dump

core.1234 is your regular core file.

chillitom
Can we convert a jdk 1.4 core dump file produced using gcore to hprof on solaris using jdk1.5/bin/jmap ? I tried using the above command but it gives the error : Error attaching to core file: can't find 'UseSharedSpaces' flag
techzen
techzen: I'm unsure on this I'm afraid.. are you definitely referencing the 1.4 java executable on the commandline? If so then it might just be that the 1.4 core dumps aren't compatible.
chillitom
A: 

Actually, VisualVM can process application core dump.

Just invoke "File/Add VM Coredump" and will add a new application in the application explorer. You can then take thread dump or heap dump of that JVM.

JB
+1  A: 

Try the lady4j stack analyzer, it could help you:

http://www.lady4j.com/solveStack.jsp

Axel
A: 

jhat is one of the best i have used so far.To take a core dump,I think you better use jmap and jps instead of gcore(i haven't used it).Check the link to see how to use jhat. http://www.lshift.net/blog/2006/03/08/java-memory-profiling-with-jmap-and-jhat

Emil