Fix: java.lang.OutOfMemoryError

PermGen space is the abbreviation of Permanent Generation space, referred to as memory permanent preservation area OutOfMemoryError: PermGen space on the surface is the memory of the benefits, solutions must be increased memory. Why would the memory benefits: this part is used to store the Class and Meta information, Class was when the Load is placed in the PermGen space region, Heap region it and store different Instance, GC (Garbage Collection) not in the main program running on PermGen space to clean up, so if you APP LOAD a lot of CLASS, it is very likely that the PermGen space error. This error was common in web server on the JSP pre compile. Correction: OUTOFMEMORY error occurred in the -Xms256m -Xmx256m -XX:MaxNewSize=256m -XX:MaxPermSize=256m 2, in Tomcat redeploy. You can have the following reasons:
1,The use of Proxool, because Proxool contains an old version of cglib.
2, log4j,Not the best, only common-logging
3, The old version of cglib, to update to the latest version.
4, The update to the latest hibernate3.2 3,
Here in Tomcat environment as an example, the other WEB server such as JBoss, Weblogic is the same reason.
A, java.lang.OutOfMemoryError: PermGen space PermGen spaceFull name isPermanent Generation space,Refers to the permanent preservation area of memory, This memory isJVMDepositClassAndMetaInformation,ClassIn beLoaderWill be inPermGen spaceIn the, It and storing an instance of the class(Instance)TheHeapDifferent regions,GC(Garbage Collection)Not in the main program running on PermGen spaceClean up, So if there are many CLASS words in your application, it may PermGen space error, this error was common in web server on the JSP pre compile. If your WEB APP with a large number of third party jar, the size of more than JVM the default size (4M) will produce the error information.
Solution: manually set the MaxPermSize size modification of TOMCAT_HOME/bin/catalina.sh in "echo" Using CATALINA_BASE: $CATALINA_BASE "" add the following line: JAVA_OPTS="-server -XX:PermSize=64M -XX:MaxPermSize=128m
Suggestion: use the same third party jar file transfer to the tomcat/shared/lib directory, so that can reduce repeated memory to jar document.
Two, java.lang.OutOfMemoryError: Java heap space Heap size sets the JVM heap set refers to the operating process of Java program in JVM can allocate memory space used to set the.JVM automatically sets the Heap size value at the time of the launch, the initial space (-Xms) is the physical memory of 1/64, the maximum space (-Xmx) is the physical memory 1/4. Can be provided by the use of JVM -Xmn -Xms -Xmx options can be set. Heap size is the size of the Young Generation and Tenured Generaion and. Note: in JVM if 98% of the time for GC and available Heap size less than 2% will throw this exception information. Tip: Heap Size maximum should not exceed the available physical memory is 80%, the general to -Xms and -Xmx options set to be the same, while the -Xmn 1/4 -Xmx value.
Solution: manually set the Heap size to modify the TOMCAT_HOME/bin/catalina.sh in "echo" Using CATALINA_BASE: $CATALINA_BASE "" add the following line: JAVA_OPTS="-server -Xms800m -Xmx800m -XX:MaxNewSize=256m"
Three, example, parameters of Java JVM the 1G memory environment reference: JAVA_OPTS="-server -Xms800m -Xmx800m -XX:PermSize=64M -XX:MaxNewSize=256m -XX:MaxPermSize=128m -Djava.awt.headless=true "




From

Posted by Will at December 13, 2013 - 2:47 PM