MyEclipse Developing a memory overflow solution myeclipse tuning JVM memory size java.lang.OutOfMemoryError:PermGen space and its solutions

Source: Internet
Author: User

Summary: After Tomcat deploys multiple projects, the startup Tomcat is normal and the error occurs when you access the project
Check on the internet and tried several times, only to solve, the solution is recorded to facilitate later viewing or to meet the same problem friends have a reference

PermGen space is what will not say, looking for a lot of online, feel there is no need to remember these concepts

The root of the problem is that the JVM does not have enough memory!!!
Workaround:

*************************************************************************************************************** *****
If you are developing a project in the IDE, take MyEclipse as an example,
Window->preferences->myeclipse->servers->tomcat x.x->jdk->optional Java VM arguments:

-xms256m-xmx256m-xx:permsize=512m-xx:maxpermsize=512m

Depending on the situation, you can change the specified memory size.

****************************************************************************************************
-xms256m: Indicates JVM heap (heap memory) minimum size 256MB, initial allocation
-xmx256m: Represents the maximum allowable size of the JVM heap (heap memory) 512MB, on demand.
Note: If-XMX is not specified or is specified as small, the application may cause a java.lang.OutOfMemory error from the JVM that is not throwable and cannot be captured with Try...catch.


-XX:PERMSIZE=512MB minimum size, initial allocation
-XX:MAXPERMSIZE=512MB maximum allowable allocation size, on demand, too small will cause: Java.lang.OutOfMemoryError:PermGen space
Description: PermSize and maxpermsize indicate the size of the virtual machine for the Java permanently generated object (permanate generation), such as the class object, the method object, which are the reflection (reflective) objects that allocate memory limits. The memory is not included in the heap memory area.


The MaxPermSize default value is related to the-server-client option.
-server option, the default maxpermsize is 64m
-client option, the default maxpermsize is 32m
****************************************************************************************************

If you are not developing your project in the IDE, you will need to change the configuration file for Tomcat:

Windows environment:%tomcat_home%/bin/catalina.bat file:
At the beginning of the position plus:

Set Java_opts=-server-xms256m-xmx256m-xx:permsize=512m-xx:maxpermsize=512m-xx:-usegcoverheadlimit%JAVA_OPTS%

So it's done.

Note: If you only change the Catalina.bat file and start tomcat through the IDE, the IDE ignores the parameters set in the Catalina.bat file, so it's best to make changes at 2.

*************************************************************************************************************** *****
Linux environment: Modify the catalina.sh file,
Cygwin=false
Before adding

Java_opts= "-server-xmx256m-xms256m-xx:permsize=512m-xx:maxpermsize=512m"

  

MyEclipse Developing a memory overflow solution myeclipse tuning JVM memory size java.lang.OutOfMemoryError:PermGen space and its solutions

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.