In the development of many of us have encountered a memory overflow situation, in fact, memory overflow in several forms:
1. Java.lang.OutOfMemoryError:PermGen space exception Handling in Tomcat (most common)
Concept we can check, in fact, we are still concerned about the solution:
Workaround:
(1)
Manually set the MaxPermSize size modification tomcat_home/bin/catalina.sh
echo "Using catalina_base: $CATALINA _base"
Add the following line above:
Java_opts= "-server-xx:permsize=64m-xx:maxpermsize=128m
(2) Modify the Tomcat configuration in eclipse:
Added:-xms256m-xmx1024m-xx:permsize=64m-xx:maxpermsize=128m
2. Java.lang.OutOfMemoryError:Java Heap Space
This problem occurs because there are too many objects created by the Java Virtual machine, and the virtual machine allocates enough memory space to the heap for garbage collection, which is related to heap space. There are two ways to solve this kind of problem:
1. Check the program to see if there are dead loops or unnecessarily repeatedly creating a large number of objects. After you find the cause, modify the program and algorithm.
2. Increase the size of the XMS (initial heap size) and XMX (maximum heap size) parameters in the Java Virtual machine. such as: Set java_opts=-xms256m-xmx1024m
Summary: Memory processing, is a developer of good development habits of the test, many years of development process, let me know, the development of great God Master is not more than cattle technology, is a good development habit of a form, details determine success or failure!
Common solutions for Java.lang.OutOfMemoryError in Java