JVM related parameters and commands

(1)-Xms20M

Indicates that the minimum value of the heap capacity is set to 20M, which must be in M ​​units

(2)-Xmx20M

Indicates that the maximum heap size is set to 20M, which must be in M ​​units. Set -Xmx and -Xms the same to avoid heap auto-expansion. For large projects -Xmx and -Xms are generally set to 10G, 20G or even higher

(3)-verbose:gc

Indicates the details of the GC in the output virtual machine

(4)-Xss128k

Indicates that the size of the virtual machine stack can be set to 128k

(5)-Xoss128k

Indicates that the size of the native method stack is set to 128k. However, HotSpot does not distinguish between the virtual machine stack and the native method stack, so this parameter is invalid for HotSpot

(6)-XX:PermSize=10M

Indicates the capacity of the permanent generation initially allocated by the JVM, which must be in units of M

(7)-XX:MaxPermSize=10M

Indicates the maximum capacity of the permanent generation that the JVM is allowed to allocate. It must be in M ​​units. In most cases, this parameter defaults to 64M.

(8)-Xnoclassgc

Indicates that the garbage collection of the class by the JVM is turned off

(9)-XX:+TraceClassLoading

Indicates to view the loading information of the class

(10)-XX:+TraceClassUnLoading

Indicates to view the uninstallation information of the class

(11)-XX:NewRatio=4

Indicates that the size ratio of the young generation: the old generation is 1:4, which means that the young generation accounts for 1/5 of the entire heap

(12)-XX:SurvivorRatio=8

Indicates that 2 Survivor areas are set: the size ratio of 1 Eden area is 2:8, which means that the Survivor area occupies 1/5 of the entire young generation, and this parameter defaults to 8

(13)-Xmn20M

Indicates that the size of the young generation is set to 20M

(14)-XX:+HeapDumpOnOutOfMemoryError

Indicates that the virtual machine can dump the current heap memory dump snapshot when a memory overflow exception occurs.

(15)-XX:+UseG1GC

Indicates that the JVM uses the G1 garbage collector

(16)-XX:+PrintGCDetails

Indicates that the specific details of the GC are printed on the console

(17)-XX:+PrintGC

Indicates that GC information is printed on the console

(18)-XX:PretenureSizeThreshold=3145728

Indicates that when the object is larger than 3145728 (3M), it directly enters the old generation allocation, which can only be in bytes.

(19)-XX:MaxTenuringThreshold=1

Indicates that the age of the object is greater than 1, and it automatically enters the old age

(20)-XX:CompileThreshold=1000

Indicates that after a method is called 1000 times, it will be considered as hot code and trigger just-in-time compilation

(21)-XX:+PrintHeapAtGC

Indicates that you can see the heap memory layout before and after each GC

(22)-XX:+PrintTLAB

Indicates that you can see the usage of TLAB

(23)-XX:+UseSpining

turn on spin lock

(24)-XX:PreBlockSpin

Change the number of spins of the spin lock. To use this parameter, the spin lock must be enabled first.

Link

Common JVM command parameters

JVM Troubleshooting Guide

JVM learning eight: common JVM configuration parameters

Several common memory overflows in Java and their solutions

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324910160&siteId=291194637