java.lang.OutOfMemoryError:PermGen 空间(不是通常的嫌疑人!)
jsp页面中的这一行就出现错误!
<table:table name="sessionScope.users" sort="external" pagesize="50" id="user" class="list"
requestURI="/admin-users.html" partialList="true" size="sessionScope.fullListSize">
我尝试使用其他帖子中的方法将 perm gen max 增加到 512m,无论是对于 eclipse 的调用还是 Tomcat 的实例。
好的,所以需要更多的上下文:这是我的开发系统,在 eclipse 中运行,并指向一个独立的 tomcat 实例,它是 Eclipse 中的服务器。
根据 Recurring "PermGen" in Tomcat 6,我的 Eclipse 中有以下内容。文件名:
--launcher.XXMaxPermSize
512m
// ...
-XX:MaxPermSize=512m
-XX:+UseConcMarkSweepGC
-XX:+CMSPermGenSweepingEnabled
-XX:+CMSClassUnloadingEnabled
-Xms256m
-Xmx512m
The error occurs on this line in a jsp page!
<table:table name="sessionScope.users" sort="external" pagesize="50" id="user" class="list"
requestURI="/admin-users.html" partialList="true" size="sessionScope.fullListSize">
I've tried increasing the perm gen max to 512m, using the methods found in other posts, both for the invocation of eclipse and the instance of Tomcat.
Ok, so a bit more context is required: THis is my dev system, running in eclipse, and pointing to a standalone instance of tomcat that is a server within Eclipse.
According to Recurring "PermGen" in Tomcat 6, I have the following in my eclipse.ini:
--launcher.XXMaxPermSize
512m
// ...
-XX:MaxPermSize=512m
-XX:+UseConcMarkSweepGC
-XX:+CMSPermGenSweepingEnabled
-XX:+CMSClassUnloadingEnabled
-Xms256m
-Xmx512m
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一个编写良好的 Web 应用程序在重新部署时不应该保留其类加载器,但有很多原因会导致这种情况。
如果您在 Tomcat 上运行,您可能想在
server.xml
中尝试以下操作:此页面有更多信息。
A well-written webapp shouldn't hang onto its classloader when redeployed, but there are numerous reasons why it might.
If you're running on Tomcat, you might like to try this in the
server.xml
:This page has much more info.
您可能向 Tomcat 重新部署了太多次。反弹 Tomcat 就可以了 - 直到您再次通过太多的重新启动填满了永久代空间。
更新:
如果您每次点击该页面时都会发生这种情况,我会担心您的页面正在做什么。 JSP 是 servlet 的模板,随后将其编译为 .class 文件。如果该 JSP 太大以至于填满了您的永久代空间,那么您就会遇到一个大问题。
所有关于泄漏检测的建议对我来说似乎都是错误的。泄漏通常会随着时间的推移而显现出来。您在下面说过,每次访问都会发生这种情况。
我建议如下:
You probably redeployed one time too many to Tomcat. Bounce Tomcat and it'll be fine - until you've filled up the perm gen space with too many restarts again.
UPDATE:
I'd be worried about what your page is doing if it's happening every single time you hit that page. A JSP is a template for a servlet, which is subsequently compiled into a .class file. You've got a big problem if that JSP is so big that it's filling up your perm gen space.
All the suggestions about leak detection seem wrong headed to me. Leaks usually manifest themselves over time. You said below that it happens on every access.
I'd recommend the following: