问题描述
我经常在PermGen中检测我的环境中的OOM:
I constantly detect OOM in PermGen for my environment:
- java 6
- jboss- 4.2.3
- 不是一个大的网络应用程序
我知道String.intern( )问题 - 但我没有足够的宝贵用法。
MaxPermGen大小的增加没有用力(从128 Mb到256 Mb)。
I know about String.intern() problem - but I don't have enough valuable usage of it.Increasing of MaxPermGen size didn't take a force (from 128 Mb to 256 Mb).
还有什么其他原因可以为PermGen调用OOM?
在这种情况下(策略,工具等)最好的调查方案是什么?
What other reasons could invoke OOM for PermGen?What scenario of investigation is the best in such situation (strategy, tools and etc.)?
感谢您的帮助
推荐答案
- 将JDBC驱动程序放在common / lib中(如tomcat文档所示)而不是WEB-INF / lib
- 不要将commons-logging放入WEB-INF / lib,因为tomcat已经引导它了
新的类对象获取放入PermGen,因此占据了越来越多的空间。无论你制作PermGen空间有多大,它都将在经过足够的部署后不可避免地达到顶峰。你需要做的是采取措施冲洗PermGen,以便你可以稳定它的大小。有两个JVM标志可以处理这种清理:
new class objects get placed into the PermGen and thus occupy an ever increasing amount of space. Regardless of how large you make the PermGen space, it will inevitably top out after enough deployments. What you need to do is take measures to flush the PermGen so that you can stabilize its size. There are two JVM flags which handle this cleaning:
-XX:+CMSPermGenSweepingEnabled
此设置包括垃圾收集运行中的PermGen。默认情况下,PermGen空间永远不会包含在垃圾收集中(因此无限制地增长)。
This setting includes the PermGen in a garbage collection run. By default, the PermGen space is never included in garbage collection (and thus grows without bounds).
-XX:+CMSClassUnloadingEnabled
此设置告诉PermGen垃圾收集扫描对类对象采取操作。默认情况下,即使在garabage集合期间访问PermGen空间,类对象也会获得免除。
This setting tells the PermGen garbage collection sweep to take action on class objects. By default, class objects get an exemption, even when the PermGen space is being visited during a garabage collection.
这篇关于PermGen Out of Memory原因的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!