Solutions for Tomcat PermGen space

Tomcat report

Caused by: java.lang.OutOfMemoryError: PermGen space异常

The full name of memory overflow PermGen space is Permanent Generation space,

It refers to the permanent storage area of ​​memory. This memory is mainly used by JVM to store Class and Meta information.

Class will be placed in PermGenspace when it is loaded by Loader. It is different from the Heap area where class instance (Instance) is stored. GC (Garbage Collection) will not clean up PermGen space during the runtime of the main program.

So if you have a lot of CLASS in your application, it is likely to have a PermGenspace error,

This kind of error is common when the web server precompiles the JSP.

If your WEB APP uses a lot of third-party jars,

If its size exceeds the jvm default size (4M), this error message will be generated.

 

Heap memory allocation:  

  -Xms The memory initially allocated by the JVM is specified by -Xms, and the default is 1/64 of the physical memory;  

  -Xmx The maximum memory allocated by the JVM is specified by -Xmx, and the default is 1/4 of the physical memory; when the default free heap memory is less than 40%, the JVM will increase the heap until the maximum limit of -Xmx; when the free heap memory is greater than 70% , the JVM will reduce the heap up to a minimum limit of -Xms. Therefore, the server generally sets -Xms, -Xmx equal to avoid adjusting the size of the heap after each GC.

Solution:

Set the memory size of TOMCAT

1.MyEclipse

Window-->reference-->MyEclipse-->Application Servers-->Tomcat-->Tomcat 8.x-->JDK-->Optional Java VM arguments下填上:-Xms512m -Xmx1024m

Guess you like

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