系统运行在MAVEN中的jetty插件下,当在ECLIPSE运 clean jetty:run时系统提示OutOfMemoryError: PermGen space。
解决办法:
设置run as --->run configuragtions--->jre标签下的属性VM arguments:
-server -Xms512m -Xmx1024m -XX:PermSize=512m -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -XX:+PrintGCDetails -Xloggc:%M2_HOME%/gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=%M2_HOME%/java_pid.hprof
其中参数说明如下:
-XX:+CMSPermGenSweepingEnabled : 允许permgenspace的垃圾回收
-XX:+CMSClassUnloadingEnabled : allows the garbage collector to remove even classes from the memory
-XX:PermSize=256M -XX:MaxPermSize=256M : raises the amount of memory allocated to the permgenspace
解决失败用例:
1.在系统环境变量中添加 MAVEN_OPTS="-Xms40m -Xmx512m -XX:PermSize=512m" 不行,
2.在eclipse.ini文件中添加 -Xms40m -Xmx512m -XX:PermSize=512m 也不行。
3.run as --->run configuragtions--->jre标签下的属性VM arguments:
-Xms512m -Xmx1024m
解决办法:
设置run as --->run configuragtions--->jre标签下的属性VM arguments:
-server -Xms512m -Xmx1024m -XX:PermSize=512m -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -XX:+PrintGCDetails -Xloggc:%M2_HOME%/gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=%M2_HOME%/java_pid.hprof
其中参数说明如下:
-XX:+CMSPermGenSweepingEnabled : 允许permgenspace的垃圾回收
-XX:+CMSClassUnloadingEnabled : allows the garbage collector to remove even classes from the memory
-XX:PermSize=256M -XX:MaxPermSize=256M : raises the amount of memory allocated to the permgenspace
解决失败用例:
1.在系统环境变量中添加 MAVEN_OPTS="-Xms40m -Xmx512m -XX:PermSize=512m" 不行,
2.在eclipse.ini文件中添加 -Xms40m -Xmx512m -XX:PermSize=512m 也不行。
3.run as --->run configuragtions--->jre标签下的属性VM arguments:
-Xms512m -Xmx1024m
本文详细介绍了在使用Maven和Jetty插件时遇到OutOfMemoryError:PermGenspace错误的解决方法。通过调整VMarguments参数,包括-Xms、-Xmx、-XX:PermSize、-XX:MaxPermSize等,可以有效解决内存溢出问题。同时讨论了在系统环境变量、eclipse.ini文件中添加参数时的失败案例,并提供了正确的配置步骤。
2745

被折叠的 条评论
为什么被折叠?



