PermGen space全称是permanent generation space,是JVM中用来保存Class(属性,方法,静态成员)信息的那一部分内存,GC不会主动回收这一部分内存,可称之为JVM中内存的永久保存区域
这2天测试程序的时候,隔段时间就会碰到这个错,记录一下查找问题的方法和修改JVM参数的方法
可用jstat命令查看内存状况 jstat -gcpermcapacity pid
官方命令使用说明
http://download.oracle.com/javase/1.5.0/docs/tooldocs/share/jstat.html
修改JVM参数
JAVA_OPTS='-Xms1024m -Xmx1024m -XX:PermSize=128M -XX:MaxPermSize=256m '
-
-XX:+CMSPermGenSweepingEnabled
: this setting enables garbage collection in the permgenspace -
-XX:+CMSClassUnloadingEnabled
: allows the garbage collector to remove even classes from the memory -
-XX:PermSize=64M -XX:MaxPermSize=128M
: raises the amount of memory allocated to the permgenspace
这个问题好像是因为jetty的热部署导致的,应该是jetty的热部署有BUG,我用的jetty版本(jetty-hightide-7.6.0.RC0)