Poonam Bajaj's Blog

Utility to compare Class Histograms

Poonam Parhar
Consulting Member of Technical Staff

We use the Class Histograms generated by -XX:+PrintClassHistogram jvm
option quite often to diagnose memory leak issues. But we have to
manually compare the histogram entries to analyze the difference between
entries and the growth in heap.

I have written a utility in Java that reads the histograms from the
file containing these histogram dumps and shows them in a graphical
interface. One can click on these histograms and view them in this
utility and can also compare any two histograms.

How it works:

- Compile the source java files located here: CompareHistogram Source

or just take the compiled jar file from here: CompareHistograms.jar

and Launch CompareHistograms class file. This will bring up the main window of the tool.

java CompareHistograms or java -jar CompareHistograms.jar

- Select the file containing histograms File->Open Histogram File.
You will see this file in the "Histogram File" text field.

- It will show the histograms present in the file.

- Double click any histogram to view it.

- Select any two entries and click the "Compare Histograms" button to compare histograms.

- The histograms and histogram diffs can be exported to text files using Tools->Export Histogram menu item.

Join the discussion

Comments ( 1 )
  • guest Thursday, August 7, 2008


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.