OpenJDK 9: Life Without HPROF and jhat

| by Monica Beckwith Follow 397 Followers on Dec 11, 2015. Estimated reading time: 2 minutes |

A note to our readers: You asked so we have developed a set of features that allow you to reduce the noise: you can get email and web notifications for topics you are interested in. Learn more about our new features.

OpenJDK is decommissioning the HPROF agent and removing the 'jhat' tool from the JDK. This is a result of the modularization coming to OpenJDK 9’s Java SE Platform in the form of Project Jigsaw; in order to prepare for modularization, multiple proposals (JEPs) were drafted and many have already reached completion.

Let’s take a closer look at two JEPs that relate to the modular JDK, aimed at removal of the HPROF agent and the ‘jhat’ tool:

Removal of the JVM Tool Interface HPROF Agent

HPROF is a profiler agent that uses the JVM Tool Interface (JVMTI) to demonstrate the tool interface and usage of Bytecode Instrumentation. The HPROF agent can write profiling information to a file, such as heap usage based on allocation sites, heap dumps, CPU usage, monitor contention, etc. or send it over a socket. HPROF was not intended to be a production tool; it has been superseded by various other alternatives as documented below:

HPROF would be able to obtain heap allocation profiles and CPU usage sampling and times profiles by the following commands in their simplest forms (respectively):

java -agentlib:hprof=heap=sites <classname>

java -agentlib:hprof=cpu=samples <classname>

java -agentlib:hprof=cpu=times <classname>

The corresponding functionality can also be provided by Java performance monitoring tool VisualVM, a visual tool that integrates several command line JDK tools and lightweight profiling capabilities. Unlike HPROF, VisualVM is intended for use in production as well as development, and provides additional features such as generation of thread (and heap) dumps, browsing heap dumps, local and remote Java application monitoring, offline performance analysis, etc.

The HPROF tool also generates heap dumps by the following command:

java -agentlib:hprof=heap=dump <classname>

According to JEP 240, this functionality is superseded by the same functionality in the JVM by using the command line utilities such as ‘jcmd’ and ‘jmap’ as shown below:

jcmd GC.heap_dump filename=<filename>


jmap [option] <pid>

where <option>:

-dump:<dump-options> to dump java heap in hprof binary format


             live         dump only live objects; if not specified,

                          all objects in the heap are dumped.

             format=b     binary format

             file=<file>  dump heap to <file>

Example: jmap -dump:live,format=b,file=heap.bin <pid>

According to the ‘jcmd’ utility document, ‘jcmd’ is the recommended tool to use in order to create a heap (hprof) dump.

Removal of the ‘jhat’ Tool

‘jhat’ is a heap analysis tool that parses a Java heap dump and enables web-browsing a parsed heap dump. With ‘jhat’, the user can choose to execute a few standard queries or write their own using the OQL interface.

According to JEP 241, jhat is an experimental, unsupported, and out-of-date tool. Although the JEP doesn’t specify any particular replacement tool, InfoQ would once again point users to Java VisualVM for heap dump creation, visualization and analysis. VisualVM also allows users to execute their own queries or use the standard ones.

We will be providing additional coverage of the above mentioned use-cases in upcoming items.

Rate this Article

Adoption Stage

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

For heap dump analysis Eclipse MAT is a great jhat alternative by Alex Hornby

Used a patched jhat to find classloading memory leaks by Mauro Molinari

In the past I used a patched jhat to find classloading memory leaks on webapp restart under Tomcat. It was very handy and no other memory analyser tool could help to get the same information (at least the free ones).

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

2 Discuss

Login to InfoQ to interact with what matters most to you.

Recover your password...


Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.


More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.


Stay up-to-date

Set up your notifications and don't miss out on content that matters to you