Tomcat server appears Java.lang.OutOfMemoryError:Java heap space exception
1, may be a program error, such as: The program into a dead loop
2, heap memory is too small
In general, Java-created objects are collected by GC after they are not used for a period of time
If the amount of data processed at the same time is large: such as larger query results or open large files, there may be a heap of memory problems
JVM default heap memory is 64M, changing the default heap size by configuration
Set java_opts=%java_opts%-xms512m-xmx1024m
3, after running for some time, may appear java.lang.OutOfMemoryError:PermGen space anomaly
All new objects generated by the JVM are placed in the new domain. Once the object has experienced a certain amount of garbage collection loops, it gets the usage period and goes into the old domain.
In a permanent domain, the JVM stores the class and method objects. In the case of configuration, a permanent domain is a stand-alone domain and is not considered part of the heap.
After the jar file is loaded, it may be placed in a permanent domain and will not be freed by GC dynamics.
JVM permanent domain default Java.lang.OutOfMemoryError:PermGen space exception may occur when only 32m,jar more
Change the size of the permanent domain through the following configuration
Set java_opts=%java_opts%-xx:permsize=256m-xx:maxpermsize=512m
4. Recommended for one-time configuration in Tomcat's Catalina.bat file
Set java_opts=%java_opts%-xms512m-xmx1024m-xx:permsize=256m-xx:maxpermsize=512m