Java Memory Analysis 2__java memory analysis

Source: Internet
Author: User
Tags dbx memory usage jconsole
reprint: https://my.oschina.net/xionghui/blog/491741Take a look. Jstat

The specific parameters are as follows:

-class: Statistics class loader behavior information
-compile: Statistical compilation Behavior Information
-GC: Statistics JDK gc heap information
-gccapacity: Statistics of different generations (including the neonatal area, Old age area, permanent area) corresponding heap capacity
-gccause: Statistics GC situation, (same as-gcutil) and events that cause GC
-GCNEW: Statistical GC When the Cenozoic situation
- Gcnewcapacity: Statistical GC when the Cenozoic heap capacity
-gcold: Statistical GC When the situation of the old zone
-gcoldcapacity: Statistical GC, old age area heap capacity
- Gcpermcapacity: When statistical GC, permanent area heap capacity
-gcutil: Statistical GC, Heap situation

$ jstat-class 17970 1000 10 (monitored once every 1 seconds, 10 times)
Loaded Bytes unloaded Bytes time
7837 8534.0 1069 1005.7 27.87

Loaded:number of Classes Loaded.

Bytes:number of Kbytes Loaded.

Unloaded:number of classes unloaded.

Bytes:number of Kbytes unloaded.

Time:time spent performing class load and unload operations.

$ JSTAT-GC 17970 2000 20 (monitored every 2 seconds, 20 times)

$ jstat-gcutil 17970 1000 10 (Explicit by percentage)
s0c s1c s0u s1u EC EU OC OU PC PU YGC YGCT FGC FGCT GCT
15936.0 15936.0 9030.8 0.0, 127872.0 61813.5 901120.0 544712.5 65536.0 35227.8 42078 2796.028 417 498.596 329 4.624

S0c:current survivor Space 0 Capacity (KB).

S1c:current survivor Space 1 Capacity (KB).

S0u:current Survivor Space 0 utilization (KB).

S1u:current Survivor Space 1 utilization (KB).

Ec:current Eden Space Capacity (KB).

Eu:eden Space Utilization (KB).

Oc:current old space Capacity (KB).

Ou:old Space Utilization (KB).

Pc:current permanent Space Capacity (KB).

Pu:permanent Space Utilization (KB).

Ygc:number of young generation GC Events.

Ygct:young Generation garbage collection time.

Fgc:number of full GC events.

Fgct:full garbage collection time.

Gct:total garbage collection time.

$ Jstat-compiler 17970 (displays the number of VM Just-in-time compilation, etc.)
Compiled Failed Invalid Time Failedtype Failedmethod
3780 1 0 120.26 2 com/xxx/xxx Run

Jstat–gccapacity: Can show the use and occupancy of three generations (Young,old,perm) objects in VM memory, such as: PGCMN Displays the minimum perm memory usage, PGCMX displays the maximum amount of memory used by Perm. PGC is currently the newly generated perm memory footprint, and the PC is but the previous perm memory footprint. Other can be based on this analogy, OC is the pure amount of old.

[Root@localhost bin]# jstat-gccapacity 25917

NGCMN 640.0

NGCMX 4992.0

NGC 832.0

s0c 64.0

S1c 64.0

EC 704.0

OGCMN 1408.0

OGCMX 60544.0

OGC 9504.0

OC 9504.0 OC is the total amount of pure in old

PGCMN 8192.0 PGCMN shows the minimum amount of perm memory usage

PGCMX 65536.0 PGCMX Displays the maximum amount of memory used for Perm

PGC 12800.0 PGC is the current newly generated perm memory footprint

PC 12800.0 PC is but front perm memory footprint

YGC 164

FGC 6

Information for Jstat-gcnew pid:new objects

[Root@localhost bin]# jstat-gcnew 25917

s0c s1c s0u s1u TT-MTT DSS EC EU YGC YGCT

64.0 64.0 47.4 0.0 2 15 32.0 704.0 145.7 168 0.254

Information of Jstat-gcnewcapacity Pid:new object and its usage

[Root@localhost bin]# jstat-gcnewcapacity 25917

NGCMN ngcmx NGC s0cmx s0c s1cmx s1c ecmx EC YGC FGC

640.0 4992.0 832.0 64.0 448.0 448.0 64.0 4096.0 704.0 168 6

Jstat-gcold the Pid:old object's information.

[Root@localhost bin]# Jstat-gcold 25917

PC PU OC OU ygc FGC fgct GCT

12800.0 12617.6 9504.0 6561.3 169 6 0.335 0.591

Jstat-gcoldcapacity the information of the Pid:old object and the amount it occupies.

[Root@localhost bin]# jstat-gcoldcapacity 25917

OGCMN ogcmx OGC OC ygc FGC fgct GCT

1408.0 60544.0 9504.0 9504.0 169 6 0.335 0.591

Jstat-gcpermcapacity the information of the Pid:perm object and the amount it occupies.

[Root@localhost bin]# jstat-gcpermcapacity 25917

PGCMN pgcmx PGC PC ygc FGC fgct GCT

8192.0 65536.0 12800.0 12800.0 169 6 0.335 0.591

Jstat-printcompilation PID: Information about the current VM execution.

[Root@localhost bin]# jstat-printcompilation-h3 25917 1000 5

Print every 1000 milliseconds, print 5 times, and add-h3 every three lines to show the title.

Compiled Size Type method

788 1 Java/io/file <init>

788 1 Java/io/file <init>

788 1 Java/io/file <init>

Compiled Size Type method

788 1 Java/io/file <init>

788 1 java/io/file <init> jmap

Jmap-dump:format=b,file=dump.bin PID

Jmap can obtain a specific memory match from a core file or process, including heap size, Perm size, and so on, which is only available in the Solaris and Linux JDK versions.

Observe the physical memory footprint of a running JVM

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=string 3024 can output the memory heap of the 3024 process to a String file.

[Root@localhost bin]# Jmap-histo 25917

Attaching to process ID 26221 ...

Debugger attached successfully.

Client compiler detected.

JVM version is 1.5.0_08-b03

Iterating over heap. This could take a while ...

Unknown OOP at 0xaa6e42d0

Oop ' s Klass is null

Object Histogram:

Size Count Class Description

-------------------------------------------------------

3722768 30467 * Constmethodklass

1976480 25334 char[]

1907880 46994 * Symbolklass

1762088 2947 byte[]

1709536 30467 * Methodklass

1487816 2600 * Constantpoolklass

1009576 2600 * Instanceklassklass

904880 2199 * Constantpoolcacheklass

741432 30893 java.lang.String

653576 4785 int[]

351760 4397 Java.lang.reflect.Method

277824 2894 Java.lang.Class

248704 3401 short[]

200888 4411 java.lang.object[]

193656 4045 java.lang.object[]

179744 5617 Java.util.treemap$entry

175688 1800 java.util.hashmap$entry[]

165288 6887 Java.util.hashmap$entry

104736 3273 java.lang.ref.SoftReference

104136 4339 Java.lang.ref.WeakReference

96096 3521 java.lang.string[]

86160 3590 Java.util.hashtable$entry

85584 3566 java.util.ArrayList

83472 1206 java.util.hashtable$entry[]

82944 1728 Java.beans.MethodDescriptor

80560 265 * Objarrayklassklass

69120 1728 Java.util.HashMap

52464 3055 java.lang.class[]

43040 1076 Java.util.Hashtable

42496 664 Org.apache.commons.modeler.AttributeInfo

37880 947 Java.util.TreeMap

33896 557 javax.management.modelmbean.modelmbeanattributeinfo[]

33152 518 Java.beans.PropertyDescriptor

616 Org.springframework.aop.framework.ProxyFactory

608 Java.util.PropertyPermission

608 Org.springframework.beans.MutablePropertyValues

608 Org.springframework.beans.factory.support.MethodOverrides

608 2 * Arrayklassklass

608 Org.springframework.beans.factory.config.ConstructorArgumentValues

608 4 Org.apache.xerces.impl.XMLDTDScannerImpl

576 Java.util.Stack

576 java.util.regex.pattern$category

576 org.apache.naming.NamingEntry

560 7 java.net.url[]

552 Sun.management.mappedmxbeantype$basicmxbeantype

552 1 java.util.locale[]

552 java.io.objectstreamfield[]

544 Java.util.collections$synchronizedmap

176 Java.util.regex.pattern$ctype

8 1 sun.reflect.GeneratedMethodAccessor49

8 1 Sun.reflect.GeneratedMethodAccessor6

8 1 Sun.reflect.GeneratedConstructorAccessor10

Heap traversal took 12.003 seconds. Jinfo

You can output and modify the opts of the Run-time Java process. The simple use is to output and modify the Run-time parameters of the Java process. Usage is jinfo-opt pid such as: View 2788 maxperm size can be used Jinfo-flag maxpermsize 2788. Extracurricular Supplements jstatd

Http://docs.oracle.com/javase/1.5.0/docs/tooldocs/share/jstatd.html

Start the JVM monitoring service. It is an RMI based application that provides remote machines with information about native JVM applications. Default Port 1099.
Example: Jstatd-j-djava.security.policy=my.policy
My.policy files need to be built themselves, as follows:
Grant codebase "File: $JAVA _home/lib/tools.jar" {
Permission java.security.AllPermission;
}; Jdb

JDB is used for real-time debugging of core files and running Java processes, which contains a wealth of commands to help you debug, and its functionality is very similar to the DBX in Sun Studio, but Jdb is specifically intended for use with Java applications.

Used for real-time debugging of core files and running Java processes, which contains a wealth of commands to help you debug, which is very similar to the DBX in Sun Studio, but Jdb is specifically intended for Java applications. Jconsole

Jconsole is a real-time graphical monitoring tool based on JMX, which leverages the JMX instructions built into the JVM to provide real-time performance and resource monitoring, including memory usage of Java programs, Heap size, thread state, class allocation status and space usage, and so on.

Quite the same as Jstat.

Jconsole: A Java GUI monitoring tool that displays a variety of data in a graphical format. Remote connections can be used to monitor the server VM remotely.

Java-written GUI programs, used to monitor VMS and monitor remote VMS, are very easy to use and very powerful. Jconsole in the command line, the selection process is OK.

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.