Easy to Learn Java: Programming Articles, Examples and Tips

Start with Java in a few days with Java Lessons or Lectures


Code Examples

Java Tools

More Java Tools!

Java Forum

All Java Tips


Submit News
Search the site here...
Search the JavaFAQ.nu
1000 Java Tips ebook

1000 Java Tips - Click here for the high resolution copy!1000 Java Tips - Click here for the high resolution copy!

Java Screensaver, take it here

Free "1000 Java Tips" eBook is here! It is huge collection of big and small Java programming articles and tips. Please take your copy here.

Take your copy of free "Java Technology Screensaver"!.

Fast find memory leaks with Heap Analysis Tool

JavaFAQ Home » Java Tools Go to all tips in Java Tools

Bookmark and Share

Question: We have problem with memory leak in our java application. It seems that some objects do not become garbage collected.

We know that to be Garbage Collected an object must not be pointed by other one(s). Some object retention is still left. How can we find out which one does it?

Answer: It is not easy question to detect unnecessary object retention (or memory leaks).

It is true especially if an application has too many objects. Heap Analysis Tool could help. It is not included into 1.5 JDK because it is not a standard tool. The situation is changed with Java 6. It has been replaced with jhat.

HAT providing a convenient means to browse the object topology in a heap snapshot, which is generated by the Java VM. HAT reads a hprof file, then sets itself up as a web server--therefore allowing you to run queries against a heap dump contained within the hprof file. To generate a .hprof binary file, run java with the -Xrunhprof flag with "format=b" modifier:

java -Xrunhprof:file=dump.hprof,format=b MyClass

Since the Heap Analysis Tool is part of a research and development project, it is not an official product. Examples on exact HAT usage can be found at https://hat.dev.java.net/

 Printer Friendly Page  Printer Friendly Page
 Send to a Friend  Send to a Friend

.. Bookmark and Share

Search here again if you need more info!
Custom Search

Home Code Examples Java Forum All Java Tips Books Submit News, Code... Search... Offshore Software Tech Doodling

RSS feed Java FAQ RSS feed Java FAQ News     

    RSS feed Java Forums RSS feed Java Forums

All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest 1999-2006 by Java FAQs Daily Tips.

Interactive software released under GNU GPL, Code Credits, Privacy Policy