View Java Heap Dump using VISUALVM

Source: Internet
Author: User
Tags visualvm

Browse Heap Dump

You can use VISUALVM to browse the contents of a heap dump file to quickly view the objects allocated in the heap. The heap dumps is displayed in the heap Dump sub-tab of the main window. You can open the heap dump file saved locally (. hprof) or use VISUALVM to capture the heap dumps of a running program.

A heap dump is a snapshot of all objects at a time in a Java Virtual machine (JVM). The JVM allocates memory for all class instances and arrays from the heap. When an object is no longer in use and there is no reference to it, the garbage collector reclaims its heap memory. By looking at the heap, you can find a reference to the object created by the location where the object was found. If the JVM attempts to remove objects that are no longer needed from the heap, VISUALVM can navigate to the garbage collection root (garbage collecting root) closest to the object.

Open Heap dump File

If you have a heap dump file that is saved locally, load the file in VISUALVM by using File > Load menu item. VISUALVM can open a. hprof formatted heap dumps file. When opened, heap dump is used as a sub-tab of the main window.

Capture Heap Dump

You can use VISUALVM to capture a heap dump of a locally run application. The captured heap dump file is a temporary file that is automatically deleted after the VISUALVM is closed and saved as a file if you want to keep it.

The heap dump can be captured in two ways:

    • In the left "application" (application) Subwindow, right-click the appropriate application and select heap dump (heap dump).
    • Click the heap Dump button in the Monitor Sub-tab page.

The local application's heap dumps is opened as a sub-tab of the Application's tab page. At the same time, heap dump corresponds to a timestamp-containing node in the application (application) bar on the left. Right-click the node and choose Save As (Save As) to save the heap dump locally.

Browse Heap Dump

VISUALVM provides a visual view to explore the heap dumps:

Summary View (Overview)

When you open a heap dump, VISUALVM Displays the Overview tab by default. The overview view shows the capture environment and other system properties for the heap dump.

Classes View (Class)

Class View displays the list of classes and their corresponding number of instances, the percentage. Right-click the class name select Show in Instances view (display in instance view) to see a list of instances of the specified class.

Click the column header to sort by the specified column. You can filter classes by using the class name filter, which is below the class list, or you can restrict display results to subclasses of the specified class by right-clicking on a class name and selecting Show only subclasses (subclass only).

Instances View (number of instances)

The instance count view shows the object instances of the selected class. In the instance (Instance) column, select an instance, and the field and reference (References) columns on the right show the field and reference to the instance. In the reference bar, right-click a bar and select Show recent garbage collection root node (show Nearest GC root) to display the most recent garbage collection root node.

View Java Heap Dump using VISUALVM

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.