What is jhat




















Once they are added, they are never removed from the HashMap. If your heap dump size is very large, then you need to pass larger -Xmx argument size. Once heap dump is fully loaded you will see the following message:.

You will see the following screen:. Home page shows all the application packages, application class files, and pre-defined queries. Since in our application there are only 3 classes — AddressBook, Address, User — only those classes are showing up here.

Typically a real-world application will have several classes. Most of other views are redundant. By default, all classes are sorted by the total memory size they occupy.

I have always seen the leaking object be one of the top 5 in the list. As leaking objects, count is going to high. If you are not sure about the expected count, then follow the next section i. Two Heap Dumps.

Here you see our application objects i. Address, com. Along with it, you also see classes like C, I, L, B… what do they stand for? Capture first heap dump right after application started. Time period x depends on your application. Suppose if your application experiences outOfMemoryError in 3 hours after it has started, then x can be 2 hours i. Now launch the second heap on a different port. Object count almost doubled up. Okay, now we have identified leaking objects i.

The roots query gives you reference chains from the rootset to a given object. It will give you one chain for each member of the rootset from which the given object is reachable. It will take you to the User class page. This page has all the details about the User class object. Now here click on any one of the objects of the User class.

See the red color highlight in the below picture. Now you will be taken to a page which will show the details about this particular User Object. It shows details about the Member Variables of this object, their values, who is holding references to this object, ….. This page will show the root object that is holding a reference to the current User object.

See the below picture. It clearly illustrates the reference hierarchy. Bingo — now you can clearly see Address is the root object. It is the originator of the memory leak. Have patience. Educational - Best Practises.

The default is true. Turns off tracking of references to objects. Default is true. By default, back pointers, which are objects that point to a specified object such as referrers or incoming references, are calculated for all objects in the heap. Specifies a file that lists data members that should be excluded from the reachable objects query.

For example, if the file lists java. Specifies a baseline heap dump. Objects in both heap dumps with the same object ID are marked as not being new. Other objects are marked as new. This is useful for comparing two different heap dumps.

Sets the debug level for this tool. A level of 0 means no debug output. Set higher values for more verbose modes. Passes flag to the Java Virtual Machine on which the jhat command is running. For example, -J-Xmxm to use a maximum heap size of MB.



0コメント

  • 1000 / 1000