重启tomcat时有时会出现这个问题



我使用eclipse与spring mvc, spring data jpa + queryDSLapache tomcat server8,有时并不总是,但经常当我保存我的java类ctrl+s tomcat重启,我得到OutOfMemoryError: PermGen space

在eclipse中,您可以关闭auto deploy after saving,这样在保存时就不会链接部署。永久性内存在部署时使用,因此增加它只会在多次保存后再次发生

Clean Your Tomcat server and restart it 
or
**Modify Your Pergem Size :**
Open the Configuration file in the eclipse directory forlder. for eg. C:eclipse-jee-galileo-SR2-win32eclipse
just add -XX:MaxPermSize=256m command below the -vmargs line. Change value of -XX:MaxPermSize as per your requirement. If your project is big you should use 512m or 1024m. I'm using 256m in my project.
Now your eclipse.ini file should look like this
-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-product
org.eclipse.epp.package.jee.product
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256M
-vmargs
-XX:MaxPermSize=512m 
-Dosgi.requiredJavaVersion=1.5
-Xms512m
-Xmx1024m

For More Information see this 
http://wiki.eclipse.org/Eclipse.ini
U can watch here 
http://stackoverflow.com/questions/88235/dealing-with-java-lang-outofmemoryerror-permgen-space-error

我遵循dcevm解决方案,它工作得更好,它只允许更改方法主体而无需重新启动apache tomcat。

  1. 给tomcat更多内存。使用以下vm参数:-Xmx1600m -Xms1600m -XX:MaxPermSize=512m(可能有点夸张,根据您的喜好修改值)

  2. Tomcat是臭名昭著的内存泄漏时,重新加载web应用程序。

最新更新