本文主要是介绍Permgen Space导致的内存溢出,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
问题描述
最近同事系统反馈系统出现如下错误:
PermGen space的全称是Permanent Generation space,是指内存的永久保存区域。
解决过程
使用jstat查看 Permsize 占用情况,如下所示:
using thread-local object allocation.
Parallel GC with 4 thread(s)Heap Configuration:MinHeapFreeRatio = 40MaxHeapFreeRatio = 70MaxHeapSize = 2147483648 (2048.0MB)NewSize = 1310720 (1.25MB)MaxNewSize = 17592186044415 MBOldSize = 5439488 (5.1875MB)NewRatio = 2SurvivorRatio = 8PermSize = 21757952 (20.75MB)MaxPermSize = 85983232 (82.0MB)Heap Usage:
PS Young Generation
Eden Space:capacity = 715259904 (682.125MB)used = 8176712 (7.797920227050781MB)free = 707083192 (674.3270797729492MB)1.1431805353931876% used
From Space:capacity = 262144 (0.25MB)used = 0 (0.0MB)free = 262144 (0.25MB)0.0% used
To Space:capacity = 262144 (0.25MB)used = 0 (0.0MB)free = 262144 (0.25MB)0.0% used
PS Old Generationcapacity = 1431699456 (1365.375MB)used = 45577208 (43.46581268310547MB)free = 1386122248 (1321.9091873168945MB)3.183434051678511% used
PS Perm Generationcapacity = 85983232 (82.0MB)used = 85982928 (81.99971008300781MB)free = 304 (2.899169921875E-4MB)99.99964644269245% used
如上所示,可以看到PS Perm Generation被占用了99%,分配不足。
解决方案
从上面 可以看出MaxPermSize = 85983232 (82.0MB)即永久保存区域扩大设置
如:
对于Tomcat服务器,则需要修改TOMCAT_HOME/bin/catalina.sh
SET JAVA_OPTS=-XX:PermSize=64 M -XX:MaxPermSize=256 M
参考:https://blog.csdn.net/alli0968/article/details/52460008
这篇关于Permgen Space导致的内存溢出的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!