Heap dump and analyzer__java-, tuning

Source: Internet
Author: User
Tags visualvm

What's in the heap dump file.

How many objects each class has, and what their values are, can be found in the heap dump file. 1.heap Dump

In addition to using the visual VM, you can use the Jmap command. Especially if the remote machine doesn't give you an open port connection, you can only use the original command-line tool.

Will pid=9406 the heap of this Java process, dump it into the heapdump.hprof file. Live means only output information for surviving objects
jmap-dump:live,format=b,file=heapdump.hprof 9406

This binary format file cannot be read directly. Suffix hprof can be understood as heap profile.

2.visual vm Simple Analysis


Figure 2-1 Visual VM's Heapdump file analysis view


3.Memory Analyzer

A plug-in for Eclipse. You can install it by searching in eclipse marketplace. Free, the function is stronger than VISUALVM.


Figure 3-1 Searching for and installing memory Analyzer

After installation, you can open a. hprof file to try.


Figure 3-2 Memory Analyzer View 4.OQL Object Lookup Language

Oql,object query Language, object lookup language.

There are thousands of classes in the heap dump file, such as popular classes like java.lang.String, and there may be thousands of objects. How to quickly find the object you are interested in, it is necessary to use the OQL.

The OQL in VISUALVM is inconsistent with the OQL syntax in Memory Analyzer, which requires attention. 4.1 Memory Analyzer's Syntax

Searches for objects with a value of "mozilla.*" in the String class. Note that the wildcard character is ' * ', not in SQL '% '
select * from java.lang.String s where toString (s) is like "mozilla.*"

5.shallow size and retained sizeShallow size is the sum of the size of the object's own base type data. Java references are equivalent to C + + pointers, so it occupies 8 bytes on a 64-bit platform and occupies 4 bytes on 32-bit platforms.
Retained size is the object's own shallow size plus the sum of the shallow size from which the object can be accessed directly or indirectly.

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.