Java Program Memory Analysis: JDK Jmap can bring us what __java

Source: Internet
Author: User
Tags unique id
A lot of times we need to analyze the Java application's memory to optimize the last encounter a memory overflow problem, with the Jmap command and Mat memory analysis tools to solve, the following is the use of the Jmap command. Memory Analysis Jmap

directory [-] JMAP command format parameter description Jmap

Prints out the case of all ' objects ' in memory in a Java process (using PID) (e.g., the resulting objects, and their number).

You can output tools for all in-memory objects, and you can even heap the VM into text in binary form. Use the method Jmap-histo pid. If you use the shell Jmap-histo Pid>a.log to save it to text, after a while, you can compare which objects the GC reclaims by using the text Contrast tool. Jmap-dump:format=b,file=outfile 3024 can output the memory heap of the 3024 process to the outfile file, together with Mat (The Memory Analyzer tool (Memory analysis Tool) or with Jhat ( Java Heap Analysis Tool) is used together to visually display the current memory problem in the form of an image.

The use of 64-bit machines requires the following methods:

Jmap-j-d64-heap pid command format

jmap [option] pid

jmap [option] executable core

jmap [option] [server-id@]remote-hostname-or-ip parameter Description

1), Options:

Executable Java executable from which the core dump is produced.

(Possibly a Java executable program that produces core dump)

Core dump file that will be printed information

Remote-hostname-or-ip the host name or IP of the Remote Debug service

Server-id Unique ID If multiple remote Debug services on a single host

2), Basic parameters:

-dump:[live,]format=b,file=<filename> uses the Hprof binary form to output the heap content of the JVM to the file =. Live sub options are optional, and if the live option is specified, only live objects are exported to the file.

-finalizerinfo Print the information for the object that is waiting to be reclaimed.

-heap prints Heap's profile, the algorithm used by GC, the configuration of heap, and the use of wise heap.

-histo[:live] Prints the number of instances per class, memory footprint, class full name information. The VM's inner class name begins with a prefix of "*". If the live child parameter is added, only the number of live objects is counted.

-permstat Prints Classload and JVM heap information for a long time. Contains the name, liveliness, address, parent ClassLoader, and number of classes loaded for each classloader. In addition, the number of internal strings and the amount of memory consumed are printed.

-F forced. Use-dump or-histo parameters when the PID does not correspond. In this mode, the live child parameter is invalid.

-H | -HELP Printing Auxiliary Information

-j pass parameters to the Jmap-initiated JVM.

PID needs to be printed with the Java process ID of the phase information

First look at the JAVAW process number, 7712

Jmap-histo PID shows the memory condition of class

The information displayed is numbered, instance number, Byte, class name


The whole heap information of jmap-heap PID display PID

The description is as follows:?

1 2 3 4 5 6 7 8 9 10
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.