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"