Linux practical Java memory leak monitoring command

Source: Internet
Author: User
Tags garbage collection time interval

Memory leaks are always a headache, and the following three commands I personally find quite useful.

1. Jstack (unique under Linux)

You can observe the current status of all threads in the JVM and the current state of the thread

Jstack 2083

The output reads as follows:


2, Jmap (Linux is unique, but also a very common command)

Observe the footprint of the running JVM's physical memory.

The parameters are as follows:

-heap : Printing JVM Heap
-histo: Prints the histogram of the JVM heap. The output information includes the class name, the number of objects, and the size of the object.
-histo:live : ditto, but only the circumstances of the surviving object
-permstat: Print permanent generation heap situation

3, Jstat

This is a more important and useful command in the JDK command to observe CLASSLOADER,COMPILER,GC related information

The specific parameters are as follows:

-class: Statistics class loader behavior information

-compile: Statistical compilation Behavior Information

-GC: Heap information when JDK GC is counted

-gccapacity: Statistics of different generations (do not know how to translate well, including the new area, old age area, permanent area) corresponding heap capacity situation

-gccause: Statistics of GC, (same as-gcutil) and events that cause GC

-gcnew: When statistical GC, the Cenozoic situation

-gcnewcapacity: When statistical GC, Cenozoic heap capacity

-gcold: When statistical GC, the situation of the old area

-gcoldcapacity: Statistical GC, heap capacity of the elderly area

-gcpermcapacity: When GC, permanent area heap capacity

-gcutil: When statistical GC, heap situation

-printcompilation: Do not know what to do, has never been used.

The general comparison of several parameters are:

Jstat-class 2083 1000 10 (monitor once every 1 seconds, do 10 times altogether)

Parameter explanation:

options-option, we typically use-gcutil to view GC situations

The VMID-VM process number, which is the currently running Java process number

interval– time interval, in seconds or milliseconds

count-the number of times printed, if the default is printed countless times

S0-heap on Survivor space 0% of the area that has been used

S1-heap on Survivor Space 1% of the area that has been used

Eden area on e-heap percentage of space already used

Percent of space used in old spaces on o-heap

Percentage of space used in P-perm area

ygc-number of young GC occurrences from application startup to sampling

ygct– time (in seconds) for young GC from application startup to sampling

fgc-number of full GC occurrences from application startup to sampling

fgct– time spent in full GC from application startup to sampling (in seconds)

gct-total time spent in garbage collection from application startup to sampling (in seconds)



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.