PermGen 内存不足原因
我经常在我的环境中检测 PermGen 中的 OOM:
- java 6
- jboss-4.2.3
- 不是一个大型 Web 应用程序,
我知道 String.intern() 问题 - 但我没有足够的有价值的用法。 MaxPermGen 大小的增加并不费力(从 128 Mb 到 256 Mb)。
还有哪些其他原因可能会导致 PermGen 出现 OOM? 在这种情况下哪种调查方案是最好的(策略、工具等)?
感谢您的帮助
I constantly detect OOM in PermGen for my environment:
- java 6
- jboss-4.2.3
- Not a big web-application
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).
What other reasons could invoke OOM for PermGen?
What scenario of investigation is the best in such situation (strategy, tools and etc.)?
Thanks for any help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请参阅此说明
新的类对象被放入 PermGen 中,从而占用越来越多的空间。无论永久代空间有多大,在足够的部署后,它都将不可避免地达到顶峰。您需要做的是采取措施刷新 PermGen,以便稳定其大小。有两个 JVM 标志可以处理此清理:
此设置包括垃圾收集运行中的 PermGen。默认情况下,PermGen 空间永远不会包含在垃圾回收中(因此会无限增长)。
此设置告诉 PermGen 垃圾收集扫描对类对象采取操作。默认情况下,类对象会获得豁免,即使在垃圾回收期间访问 PermGen 空间也是如此。
See this note
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:
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).
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.
在发生类加载器泄漏时重新部署应用程序时,通常会出现此错误,因为这意味着所有类都会再次加载,而旧版本仍然存在。
有两种解决方案:
You typically get this error when redeploying an application while having a classloader leak, because it means all your classes are loaded again while the old versions stay around.
There are two solutions: