根据 sun 的说法: “if too much time is being spent in garbage collection: if more than 98% of the total time is spent in garbage collection and less than 2% of the heap is recovered, an OutOfMemoryError will be thrown.”
jvm gc 行为中超过98% 以上的时间去释放小于 2% 的堆空间时会报这个错误。
处理方法:
1.进入tomcat bin目录 打开service.bat 文件
找到"%EXECUTABLE%" //US//%SERVICE_NAME% --JvmOptions ""
在双引号中间添加:
-Xms512M;-Xms1024M;-XX:NewRatio=3;-XX:PermSize=256M;-XX:MaxPermSize=512M;-XX:-UseGCOverheadLimit;