简体   繁体   English

OutOfMemoryError:PermGen空间

[英]OutOfMemoryError: PermGen space

I know there are many SO questions and answers on this issue; 我知道在这个问题上有很多SO问题和答案; I have tried 8 or 10 different things that worked for other people, and feel in need of analysis of what's wrong rather than trial and error. 我尝试了8或10种不同的东西,这些东西对其他人有效,并且需要分析错误而不是反复试验。

I am running on a Windows 64 bit machine, Spring Tool Suite 3.1, Jetty internal server. 我在Windows 64位机器,Spring Tool Suite 3.1,Jetty内部服务器上运行。 I am running one web application; 我正在运行一个Web应用程序; its initial screen appears, I click on a link that performs an operation, it processes for perhaps 10 seconds, and then gives me the following 它的初始屏幕出现,我点击一个执行操作的链接,它处理大概10秒,然后给我以下内容

HTTP ERROR 500
Problem accessing /corrserv/printRoom/printManagement.html;jsessionid=uroykwoyxr2y.     
Reason: 

PermGen space

Caused by:
java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:386)
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
at org.eclipse.jdt.internal.compiler.Compiler.<init>(Compiler.java:109)
at org.apache.jasper.compiler.JDTJavaCompiler.compile(JDTJavaCompiler.java:498)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:368)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:437)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:608)
at org.apache.jasper.servlet.JspServletWrapper.loadTagFile(JspServletWrapper.java:261)
at org.apache.jasper.compiler.TagFileProcessor.loadTagFile(TagFileProcessor.java:683)
at org.apache.jasper.compiler.TagFileProcessor.access$000(TagFileProcessor.java:88)
at org.apache.jasper.compiler.TagFileProcessor$TagFileLoaderVisitor.visit(TagFileProcessor.java:739)
at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1501)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2291)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2341)
at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2347)
at org.apache.jasper.compiler.Node$Root.accept(Node.java:498)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2291)
at org.apache.jasper.compiler.TagFileProcessor.loadTagFiles(TagFileProcessor.java:757)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:222)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:435)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:608)


--------------------------------------------------------------------------------
Powered by Jetty://

The following is my STS.ini file: 以下是我的STS.ini文件:

-vm
C:/Program Files (x86)/Java/jdk1.6.0_43/bin/javaw.exe
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20120522-1813
-product
org.springsource.sts.ide
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
512m
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms256m
-Xmx512m
-XX:MaxPermSize=512m

I have tried many things for the last three values. 我已经为最后三个值尝试了很多东西。 I have put in 123456789m to ensure that STS reads this particular file (it won't start with that value). 我已输入123456789m以确保STS读取此特定文件(它不会以该值开头)。 I am only running one web application. 我只运行一个Web应用程序。 I used to have -XX:PermSize as well, will be happy to try that again. 我以前也有-XX:PermSize,很乐意再试一次。 It is unfortunate that I don't know how these interact; 不幸的是,我不知道这些是如何相互作用的; only their basic meanings. 只有他们的基本含义。

I would appreciate some guidance on how to solve this, or at least how to attack it. 我会很感激如何解决这个问题,或至少如何解决它。

This is can be resolved by looking at the version (bit version) of JDK. 这可以通过查看JDK的版本(位版本)来解决。 like a 32-bit application using a 64-bit JDK version. 就像使用64位JDK版本的32位应用程序一样。 Change to the correct JDK version and the correct JRE. 更改为正确的JDK版本和正确的JRE。

The problem appears to be in the jsp itself. 问题似乎出现在jsp本身。 I would guess it is filling up PermGen with classes. 我猜它会用类填满PermGen。 Can you post the jsp code? 你可以发布jsp代码吗?

Adding memory isn't the fix to this. 添加内存不是解决此问题的方法。 There is something filling it and you need to find that something. 有一些东西填补它,你需要找到一些东西。

1) Limiting MaxPermSize to 512m probably isn't a good idea. 1)将MaxPermSize 限制为512m可能不是一个好主意。 I would definitely take it out. 我肯定会把它拿出来。

2) It couldn't hurt to consider increasing -Xmx. 2)考虑增加 -Xmx是不会有害的。

3) Here are some good links: 3)以下是一些很好的链接:

4) The most important thing is to profile your app as it's running to see if you can figure out exactly what is consuming your PermGen. 4)最重要的是在你的应用运行时对其进行分析,看看你是否可以弄清楚你的PermGen究竟是什么。 Here are some options: 以下是一些选项:

也许我错了,但问题似乎与使用Jasper的问题有关...你是否已经调查了对OutOfMemoryError的接受声明:PermGen Space - 在Tomcat上运行Spring的Jasper报告

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM