Java commands use Jmap

Source: Internet
Author: User
Tags log log

Jmap: A snapshot of the heap of a running JVM can be obtained so that the heap can be analyzed offline to check for memory leaks, to examine the creation of large objects that severely affect performance, to check what objects are most in the system, the size of the memory for various objects, and so on

Jmap is a tool that can output all in-memory objects, and even the heap in the VM can be output as text in binary. Print out a Java process (using PID) in memory, all the ' objects ' in the case (e.g., which objects are produced, and their number).

Use the method Jmap-histo pid. If you use the shell, you can save it to a file using the Jmap-histo Pid>a.log log, and after a while, using the text Comparison tool, you can compare which objects the GC recycles. Jmap-dump:format=b,file=outfile 3024 can output the 3024 process memory heap to the outfile file, and then with the Mat (Memory Analysis tool).

Code:

D:\Program Files\java\jdk1.8. 0_102\bin $ jmap-heap47960attaching to process ID47960, please wait ...                     Debugger attached successfully.                           Server compiler detected. JVM version is 25.102-B14usingThread-localObjectallocation. Parallel GC with4thread (s) Heap Configuration: Minheapfreeratio=0Maxheapfreeratio= -maxheapsize=734003200( the. 0MB) NewSize=42991616( A. 0MB) Maxnewsize=244318208(233. 0MB) Oldsize=87031808( the. 0MB) Newratio=2Survivorratio=8metaspacesize=21807104( -. 796875MB) Compressedclassspacesize=1073741824(1024x768. 0MB) Maxmetaspacesize=17592186044415MB g1heapregionsize=0(0. 0MB)                                            Heap usage:ps Young Generation Eden Space: Capacity=32505856( to. 0MB) Used=19961640( +. 036903381347656MB) Free=12544216( One. 963096618652344MB)61.40936574628276%used from Space:capacity=5242880(5. 0MB) Used=4268096(4. 07037353515625MB) Free=974784(0. 92962646484375MB)81.407470703125%used to space:capacity=5242880(5. 0MB) Used=0(0. 0MB) Free=5242880(5. 0MB)0.0%used PS old Generation capacity=87031808( the. 0MB) Used=16867360( -. 085968017578125MB) Free=70164448( the. 91403198242188MB)19.380684358527862%used5691Interned Strings occupying486856bytes.

Https://www.cnblogs.com/qlqwjy/p/7953491.html

JPS: Show All current Java process PID commands, simple and practical

D:\Program Files\java\jdk1. 8 . 0_102\bin$ JPS 15856 Remotemavenserver 17412 Jps 47960 Launcher 5224

Jstack:

Java commands use Jmap

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.