Question of the Week No. 35
Researched by Rama Roberts
Question of the Week presents answers to key questions posed by the
developer community. The intent is to pass this
important, but not always easy-to-find information on to JDC members.
The questions are selected from the JDC newsgroups generally because:
they are frequently asked, they are significant or timely, or their answers are not easily
accessible.
Note: If you have a question to which you need an answer, try the
JDC newsgroups. You can read through
the existing newsgroups, or with your free
JDC membership, you can post new messages or threads.
Topic: Analysis Tools
Question:
Memory inspection/leak detectors
I am observing a lot of memory being consumed in my application (abnormally). Is there
any tool that will allow me to view a list of objects that have not been garbage collected? Is there any other
way to track this? I have tried outputting messages to System.out through the finalize() method
in the classes, but that is just too tedious as I am dealing with a fairly large application.
Thanks.
Answer:
I have found the Heap Analysis Tool to be invaluable for tracking down problems
of this type because it allows you to view the objects that haven't been freed
and allows you to find out where the references to them are.
http://developer.java.sun.com/developer/earlyAccess/hat/
Many thanks to JDC member gyrefalcon for contributing to this answer.
Feedback from other JDC members
Tue Apr 06 13:40:57 PDT 1999
Ddunliu
Good!
Wed Apr 07 00:50:18 PDT 1999
gaute
Is there a version of this tool or similar for 1.1?
Wed Apr 07 22:29:12 PDT 1999
Anonymous
It is these type of programs that will make Java
and its programmers work quicker and better
Thu Apr 08 09:06:54 PDT 1999
JDSD
In the Applet case if yu are running this with
Netscape you can see thought java console
Thu Apr 08 10:49:42 PDT 1999
Anonymous
HAT (Heap Analysis Tool) is fine if you're using Java 1.2. Otherwise, there are not any free (or Javasoft-provided) options.
I have used OptimizeIt! with great success. Check it out at http://www.optimizeit.com.
David Dabbs
Fri Apr 09 11:15:56 PDT 1999
krajn
Recently i was evaluating JProbe by KL Group, u can try it
to see the memory usage , time, and number of objects created
by each method in your code.
THE INFORMATION PROVIDED IN THE JAVA DEVELOPER'S CONNECTION IS PROVIDED 'AS IS' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR, AND NON-INFRINGEMENT.
THIS INFORMATION IS PROVIDED AT NO CHARGE. BY USE OF THE INFORMATION YOU AGREE THAT NEITHER SUN MICROSYSTEMS, INC. NOR ITS LICENSORS WILL BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF SUN OR ITS LICENSORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING
LIMITATION MAY NOT APPLY.
THIS INFORMATION COULD INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS. CHANGES ARE PERIODICALLY ADDED TO THE INFORMATION HEREIN. SUN MICROSYSTEMS, INC.
MAY MAKE IMPROVEMENTS AND OTHER CHANGES IN THE PRODUCTS AND THE PROGRAMS DESCRIBED HEREIN AT ANY TIME WITHOUT NOTICE.