Java. lang. OutOfMemoryError: PermGen space and Its Solution

Source: Internet
Author: User

 

Production Environment: three projects are deployed in jdk1.6 and tomcat6, and a large number of third-party jar packages are used. When the fourth project is deployed and runs for one day, the fourth project throws java. lang. OutOfMemoryError: PermGen space.

Throw an exception in java. lang. OutOfMemoryError: PermGen space. Search for information online and explain it:

The full name of PermGen space is Permanent Generation space, which refers to the Permanent storage area of the memory. This memory is mainly used by JVM to store Class and Meta information, when a Class is loaded, it will be placed in the PermGen space. It is different from the Heap region where the Class Instance is stored. GC (Garbage Collection) permGen space is not cleaned up during the main program running period. Therefore, if your application contains many classes, the PermGen space error may occur, this error is common when the web server pre-compile the JSP. If your web app uses a large number of third-party jar files and the size exceeds the default jvm size (4 MB), this error message is generated.

Solution: manually set the MaxPermSize. Most of the methods on the Internet are to modify the configuration file. My operating system is windows xp, which can be set with the tool (Configure tomcat) provided by Tomcat itself. As shown in, add the two rows in the red box to java options. Use the command line parameters-XX: PermSize and-XX: MaxPermSize to set the size of the region. The value is determined based on the actual memory size of the machine. Note: Do not have spaces before and after each command line. Otherwise, tomcat startup may fail.

 

Author: "Zhang Weixiong's blog"
 

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.