The error of Premgen space appearing in Java

Source: Internet
Author: User

Http://www.cnblogs.com/xwdreamer/archive/2011/11/21/2296930.html



1. For reference:

http://blog.csdn.net/fox009/article/details/5633007

Http://hi.baidu.com/like_dark/blog/item/19c1948b3292b0799f2fb468.html

http://anyeeye.iteye.com/blog/444624

TOMCAT6 performance tuning appears java.lang.OutOfMemoryError:PermGen space

http://www.mkyong.com/tomcat/tomcat-javalangoutofmemoryerror-permgen-space/
2. Error:

Exception in Thread "Dispatcherthread" Java.lang.OutOfMemoryError:PermGen spaces
Exception in thread " Containerbackgroundprocessor[standardengine[catalina]] "Java.lang.OutOfMemoryError:PermGen space
Exception in Thread "state Saver" Java.lang.OutOfMemoryError:PermGen spaces
Exception in thread "Awt-windows" Java.lang.OutOfMemoryError:OutOfMemoryError
3. Reasons:

PermGen space is the full name of permanent Generation spaces, refers to the permanent storage area of memory, this memory is mainly by the JVM storage class and meta information, class in the loader will be placed in the PermGen In space, it differs from the heap region of the class instance (Instance), and GC (garbage Collection) does not clean up permgen spaces during the runtime of the main program, so if you have many classes in your application, PermGen space errors are most likely to occur when the Web server makes pre compile for JSPs. If your web app uses a large number of third-party jars that are larger than the JVM default size (4M), this error message is generated.
4. Solution 1:

Manually set the MaxPermSize size, if it is a Linux system, modify the tomcat_home/bin/catalina.sh, if it is a Windows system, modify the Tomcat_home/bin/catalina.bat,
In the "echo" Using catalina_base: $CATALINA _base "", add the following line:
Java_opts= "-server-xx:permsize=64m-xx:maxpermsize=128m
Recommendation: Move the same third-party jar files to the Tomcat/shared/lib directory, which will reduce the memory consumption of the jar document. 5. Settlement Method 2

Modify the Eclipse.ini file and modify it as follows:

-vmargs
-dosgi.requiredjavaversion=1.5
-xms128m
-xmx512m
-xx:permsize=64m 
-xx:maxpermsize= 128M

If also reported wrong, you can consider the following modifications

-vmargs
-dosgi.requiredjavaversion=1.5
-xms512m
-xmx1024m
-xx:permsize=256m 
-xx: maxpermsize=512m

Error:

2011-11-21 21:10:46 org.apache.catalina.loader.WebappClassLoader clearreferencesjdbc severity: The Web application [/ Application] registered the JDBC driver [Com.mysql.jdbc.Driver] but failed to unregister it while the Web application was s Topped.
To prevent a memory leak, the JDBC Driver has been, forcibly. 2011-11-21 21:10:46 org.apache.catalina.loader.WebappClassLoader clearreferencesthreads severity: The Web application [/ Application] appears to have started a thread named [MySQL Statement cancellation Timer] but has to stop it.
This is very likely to create a memory leak. 2011-11-21 21:10:46 org.apache.catalina.loader.WebappClassLoader clearreferencesthreads severity: The Web application [/ Application] appears to have started a thread named [Awt-windows] but has to stop it.
This is very likely to create a memory leak. 2011-11-21 21:10:46 org.apache.catalina.loader.WebappClassLoader clearreferencesthreads severity: The Web application [/ Application] appears to have started a ThreaD named [Thread-14] but has failed to stop it.
This is very likely to create a memory leak. 2011-11-21 21:10:46 org.apache.catalina.loader.WebappClassLoader clearthreadlocalmap severity: The Web application [/ Application] created a ThreadLocal with key of type [net.sf.json.abstractjson$1] (value [net.sf.json.abstractjson$1@ 3661eeb]) and a value of type [Java.util.HashSet] (value [[]]) but failed to remove it when the Web application is Stoppe
D. This is very likely to create a memory leak. 2011-11-21 21:10:50 org.apache.catalina.core.ApplicationContext log information: initializing Spring frameworkservlet ' Dispatcher '

Modify Catalina.bat

Add to

java_opts= "-djava.awt.headless=true-dfile.encoding=utf-8 
-server-xms1536m-xmx1536m
-xx:newsize=256m-xx : maxnewsize=256m-xx:permsize=256m 
-XX:MAXPERMSIZE=256M-XX:+DISABLEEXPLICITGC "

Examples

# jsse_home (Optional) may point at your Java Secure Sockets Extension # (JSSE) installation, whose JAR files is added to the # System class path used to start TOMC
At. # # Catalina_pid (Optional) Path of the file which should contains the PID # of CATALINA startup ja VA process, when start (fork) is used # $Id: catalina.sh 609438 2008-01-06 22:14:28z $ #------------------------- ----------------------------------------------------java_opts= "-djava.awt.headless=true-dfile.encoding=utf-8- server-xms1536m-xmx1536m-xx:newsize=256m-xx:maxnewsize=256m-xx:permsize=256m-xx:maxpermsize=256m-xx:+  DISABLEEXPLICITGC "# OS specific support.
$var _must_ is set to either true or false.
Cygwin=false os400=false darwin=false case "' uname '" in cygwin*) cygwin=true;;
os400*) os400=true;;
darwin*) darwin=true;; ESAC # Resolve Links-$ may a softlink prg= "$" 

The specific parameters according to their own machine situation depends

java_opts= "-djava.awt.headless=true-dfile.encoding=utf-8-server-xms512m 
-xmx512m-xx:newsize=256m-xx: maxnewsize=256m-xx:permsize=256m 
-XX:MAXPERMSIZE=256M-XX:+DISABLEEXPLICITGC "


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.