jhat - Java Heap Analysis Tool

In this article we are going to elaborate the jhat command tool which is a part of JAVA commands (comes with jdk package). This article is the continuation of this previous article.

As we know the standard format of commands in java, the jhat command also have the format(in command prompt)

jhat [options] [heap-dump-file] 

jhat command purses the java heap dump file and launches a web server to brows heap dumps. It supports, pre defined queries, OQL(object query language). We have to use jmap/jconsole/-XX:+HeapDumpOnOutOfMemoryError/hprof to create dump. I will explain these commands in separate post.

jhat Options :
-stack [false/true] : Turn off tracking object allocation call stack. Default is true
-refs [false/true] :  Turn off tracking of references to objects. Default is true.
-port [port-number] : Set the port-number for the jhat's HTTP server. Default is 7000.
-exclude [exclude-file] : Specify a file that lists data members that should be excluded from the "reachable objects" query.
-baseline [baseline-dump-file] : Specify a baseline heap dump. It is useful while comparing two heap dumps
-debug [int] : Sets debug level for this tool. 0=no debug . Higher values for more verbose modes. 
-J[option] : Passes option to the Java virtual machine on which jhat is running.

Mainly this tool is used for comparing and debugging a hep dump(specially when server is having problems or test fail while processing).


No comments:

Post a Comment