JVM memory overflow processing method

 

 

OOM (Out of Memory) abnormalities common for several reasons:
1) Insufficient Memory years old: java.lang.OutOfMemoryError: Javaheapspace
2) lack of permanent generation of memory: java.lang.OutOfMemoryError: PermGenspace
3) Code bug, take up memory can not be recovered in time.
OOM are likely to occur in these memory areas, the actual encounter OOM, which can be located in memory overflow areas according to the abnormality information.
By adding a parameter -XX: + HeapDumpOnOutMemoryError, the machine appears in the current Memory Dump heap dump snapshot memory overflow exception for post-mortem analysis.
JAVA_OPTS="-server -Xms512m -Xmx2g -XX:+UseG1GC -XX:SurvivorRatio=6 -XX:MaxGCPauseMillis=400 -XX:G1ReservePercent=15 -XX:ParallelGCThreads=4 -XX:
ConcGCThreads=1 -XX:InitiatingHeapOccupancyPercent=40 -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:../logs/gc.log"

4, set the minimum and maximum heap memory, maximum utilization of historical reference set
5, set the GC garbage collector for the G1
6, enable GC logging to facilitate later analysis

Guess you like

Origin www.cnblogs.com/flagsky/p/11809218.html