Showing posts with label jinfo. Show all posts
Showing posts with label jinfo. Show all posts

Tuesday, 17 February 2009

Debugging the Java Heap (jmap and other tools)

How to debug the Java heap?

There are many tools, one is jmap (shows you the heap, gc algorithm etc).

jmap -histo pid

shows the number of objects of each class in a given java process.

Debug Java Threads

jstack -l -m

-m means mixed mode (Java and native C/C++ stack frames)

Jargon

In output of jmap you'll see some jargon. For example:

CMS - Concurrent Mark Sweep (aka low latency collector). computes transitive closure of live references for garbage collection.
gc "ergonomics" - automatically selecting a gc algo based on conditions at runtime

Other Java Tools

jinfo - tells you the VM info you are running with
jps - ps for java processes, jps -l gives you the fully qualified classname
jstat - performance statistics for JVM