X

Sundararajan's Weblog

  • Java
    September 16, 2005

Mustang's HAT!

Guest Author
with

If you use Heap Analysis Tool (HAT), this is a great news for you. Mustang (Java SE 6) (build 51 onwards) includes HAT in $JDK/bin directory. This is called jhat - Java Heap Analysis Tool. So, you don't need to download HAT separately! JDK will include it as part of standard distribution.

Besides we are adding new features to jhat -- stay tuned! I'll blog more about it when the bits become available...

Join the discussion

Comments ( 11 )
  • Amit Kulkarni Saturday, September 17, 2005
    If I have to load several external files in my program, how do I load those file references into jhat?
    Right now I always get
    java.io.IOException: Thread 200001 not found for JNI local ref
  • A. Sundararajan Sunday, September 18, 2005
    Hi Amit Kulkarni: I think you are facing HPROF bug 6296437. This bug is being fixed. I don't understand the first part of your question. (i.e., "load files referenced into jhat"). jhat accepts heap dump file and does not need anything else to parse the same. Also, you can dump heap of your process using jmap utility. Unlike HPROF, jmap does not require any agent to be started with jvm. But, HPROF can get allocation site information for all objects, jmap cannot.
  • Amit Kulkarni Monday, September 19, 2005
    I thought that HAT needs a way to load external files... That is, say I am parsing from n+ files, and loading them into memory... Does HAT need access to the files?
    I read somewhere that the bug was fixed in Mustang, so I downloaded b51 to try it out...
    Thanks
  • A. Sundararajan Monday, September 19, 2005
    Hi Amit Kulkarni: I believe you are referring to reading multiple heap dump files with jhat. There is the concept of "baseline" dump file that can be used as "reference" dump to compare to another dump file. You can specify baseline dump file using the option -baseline. This is useful if you are comparing two heapdumps and want to analyze how heap changed b/w those dump files. For most use cases, you would just need to use one heap dump file -- if so, that dump file can be specified in jhat command line without using any option.
  • Amit Kulkarni Wednesday, September 28, 2005
    Hi Sundar,
    Please look at my post here and forward some comments to the 'javac' team
    Thanks
    http://forestlaw.blogspot.com/2005/09/programming-java-advice-for-sun-to-woo.html
  • A. Sundararajan Wednesday, September 28, 2005
    Hi Amit: While I can forward this, I'd suggest you post your javac comments directly to Peter Ahe's blog

    I went through your page. I think some your comments are already addressed in recent releases (for example autoboxing/unboxing in certain contexts involving generics, enhanced for-loops and -Xlint option has beed added in JDK 5.0)

    Comments about JVM command line options have nothing to do with javac. In JDK 5.0, GC Ergonomics has been improved -- hopefully that should help avoiding guess work.

  • John H. Embretsen Tuesday, December 13, 2005

    This is a bit ironic:

    I have a heap dump (binary format) which I got by using the <code>-XX:+HeapDumpOnOutOfMemoryError</code> option with Mustang (build 62). When I try to use jhat to analyze the dump file, I get an <code>OutOfMemoryError</code>!

    The dump file is approx. 80 MB.
    I tried running jhat both on a linux box and a Solaris 10 x86 box, both with 1 gig of RAM (although with less than 500 MB free (physical)).

    So, is there a way I can increase the max heap size jhat uses?

    Here's the stack trace:

    $ jhat java_pid1483.hprof
    Reading from java_pid1483.hprof...
    Dump file created Fri Dec 09 21:40:02 CET 2005
    Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
    at com.sun.tools.hat.internal.parser.HprofReader.appendToInstanceBuf(HprofReader.java:776)
    at com.sun.tools.hat.internal.parser.HprofReader.readInstance(HprofReader.java:799)
    at com.sun.tools.hat.internal.parser.HprofReader.readHeapDump(HprofReader.java:512)
    at com.sun.tools.hat.internal.parser.HprofReader.read(HprofReader.java:224)
    at com.sun.tools.hat.internal.parser.Reader.readFile(Reader.java:91)
    at com.sun.tools.hat.Main.main(Main.java:161)

  • John H. Embretsen Tuesday, December 13, 2005
    Never mind, I found the answer in Alan Bateman's blog entry called "Heap dumps are back with a vengeance!":
    <p />
    <code>
    $ jhat -J-mx512m java_pid1483.hprof
    </code>
    <p />
    I find all these blogs about Java/Mustang debugging tools very helpful! Thanks!
  • Kumar Friday, May 26, 2006
    Trying to jhat a huge file size:
    05/26/2006 05:50 AM 273,243,560 snapshot2.hprof
    C:\\workspace\\software\\jdk1.6\\bin>jhat -J-mx512m snapshot2.hprof
    Reading from snapshot2.hprof...
    Dump file created Fri May 26 05:50:07 CDT 2006
    Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
    at com.sun.tools.hat.internal.parser.HprofReader.appendToInstanceBuf(HprofReader.java:776)
    at com.sun.tools.hat.internal.parser.HprofReader.readInstance(HprofReader.java:790)
    at com.sun.tools.hat.internal.parser.HprofReader.readHeapDump(HprofReader.java:512)
    at com.sun.tools.hat.internal.parser.HprofReader.read(HprofReader.java:224)
    at com.sun.tools.hat.internal.parser.Reader.readFile(Reader.java:91)
    at com.sun.tools.hat.Main.main(Main.java:148)
    C:\\workspace\\software\\jdk1.6\\bin>jhat -J-mx1024m snapshot2.hprof
    Reading from snapshot2.hprof...
    Dump file created Fri May 26 05:50:07 CDT 2006
    #
    # An unexpected error has been detected by Java Runtime Environment:
    #
    # java.lang.OutOfMemoryError: requested 167772160 bytes for GrET in C:\\BUILD_AREA\\jdk6\\hotspot\\src\\share\\vm\\utilities\\growableArray.cpp. Out of swap space?
    #
    # Internal Error (414C4C4F434154494F4E0E494E4C494E450E4850500017), pid=3644, tid=3908
    #
    # Java VM: Java HotSpot(TM) Client VM (1.6.0-beta-b59g mixed mode)
    # An error report file with more information is saved as hs_err_pid3644.log
    #
    # If you would like to submit a bug report, please visit:
    # http://java.sun.com/webapps/bugreport/crash.jsp
    #
    What can be done in this case ?
  • tariq Tuesday, April 10, 2007
    hi there
    me also came across the same exception
    Exception java.lang.OutOfMemoryError: requested 4096000 bytes for GrET\* in D:/BUILD_AREA/jdk1.5.0_09/hotspot\\src\\share\\vm\\utilities\\growableArray.cpp. Out of swap space?
    am running JRUN 4 in win2000 my heap size for JRUN jvm settings is
    128M min and 512 Max .plz help me regarding this issue
    as well u can mail me to asmdt at yahoo dot com
    tnx
  • A. Sundararajan Thursday, April 12, 2007
    Hi Tariq: Are you getting this message from jhat or from your application>
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.