Tuning the JVM jhat

jhat - Java Heap Analysis Tool

JHAT command parsing Java heap dump file and start WebServer. jhat allows you to use your favorite WebBrowser browse heap dumps. JHAT support pre-designed queries (such as "show all instances of a known class " Foo "") and OQL ((Object Query Language Object Query Language) - one kind of query SQL-like query language heap dump can. HTTP : // localhost: 7000 / oqlhelp / instructions on OQL using this tool is experimental and may not be available in future versions of the JDK.

Here are some ways to generate a java heap dump file:

  • jmap -dump obtain a heap dump at runtime
  • jconsole obtain a heap dump at runtime by hotspotdiagnosticmxbean
  • By using -XX + HeapDumpOnOutOfMemoryError when starting java program:: -XX + HeapDumpOnOutOfMemoryError command, the program is automatically generated when OutOfMemoryError is thrown heap dump
  • Use hprof
jhat -h
Usage:  jhat [-stack <bool>] [-refs <bool>] [-port <port>] [-baseline <file>] [-debug <int>] [-version] [-h|-help] <file>

	-J<flag>          Pass <flag> directly to the runtime system. For
			  example, -J-mx512m to use a maximum heap size of 512MB
	-stack false:     Turn off tracking object allocation call stack.
	-refs false:      Turn off tracking of references to objects
	-port <port>:     Set the port for the HTTP server.  Defaults to 7000
	-exclude <file>:  Specify a file that lists data members that should
			  be excluded from the reachableFrom query.
	-baseline <file>: Specify a baseline object dump.  Objects in
			  both heap dumps with the same ID and same class will
			  be marked as not being "new".
	-debug <int>:     Set debug level.
			    0:  No debug output
			    1:  Debug hprof file parsing
			    2:  Debug hprof file parsing, no server
	-version          Report version number
	-h|-help          Print this help and exit
	<file>            The file to read

For a dump file that contains multiple heap dumps,
you may specify which dump in the file
by appending "#<number>" to the file name, i.e. "foo.hprof#3".

All boolean options default to "true"
  • Use:

jhat [ options ] <heap-dump-file>

options

Options, Options, if the use of the words must be followed later in jhat.

heap-dump-file

To see the java binary heap dump file. If a dump file contains multiple heap dumps, you can view the file in a heap behind the mosaic # <number>, ie "foo.hprof # 3".

-stack false/true

Close objects in the stack trace, note that if you assign the site information is not available in the heap dump, you must set this flag to false. The default value is true.
Turn off tracking object allocation call stack. Note that if allocation site information is not available in the heap dump, you have to set this flag to false. Default is true.


-refs false/true

Close tracking of the object reference. The default value is true. By default, is calculated for all objects in the heap to return the pointer (pointing to a given object or aka incoming object references cited therein).
Turn off tracking of references to objects. Default is true. By default, back pointers (objects pointing to a given object aka referrers or in-coming references) are calculated for all objects in the heap.


-port port-number
designated server port, default 7000.


-exclude exclude-file

Specify a file should be "reachable objects" query data to exclude members of the list. For example, if the files are listed java.lang.string.value, then every time the list object can be accessed is calculated from the specific object "o", the path will not be considered relates java.lang.string.value reference field.
Specify a file that lists data members that should be excluded from the "reachable objects" query. For example, if the file lists java.lang.String.value, then, whenever list of objects reachable from a specific object "o" are calculated , reference paths involving java.lang.String.value field will not considered.


-baseline baseline-dump-file

Specifies the baseline heap dump (baseline heap dump). Two stacks dump same object ID of the object will not be marked as "new". Other objects will be marked as "new". This is useful when comparing two different heap dumps.


-debug int

Set the debug level of 0 indicates no debug output, the higher the value, the output of the model in more detail.

-version

Print version number and exit.

eg:

jhat -version
jhat version 2.0 (java version 1.8.0_73)


-J <flag>
Specifies the jhat jvm command. eg: jhat -J-Xmx512m.

 

Guess you like

Origin blog.csdn.net/top_explore/article/details/95166138