简体   繁体   English

PermGen空间错误

[英]PermGen Space Error

I have deployed an very big application, and when I tried to start up the server its giving 我已经部署了一个非常大的应用程序,当我尝试启动服务器时,

"Out of memory Error" : PermGen space “内存不足错误”:PermGen空间

Since am using tomcat 5.5, i have no "setenv.bat" inside bin folder. 由于我正在使用tomcat 5.5,因此我在bin文件夹中没有“ setenv.bat”。 So i have set JAVA_OPTS which is in "catalina.bat". 所以我已经在“ catalina.bat”中设置了JAVA_OPTS。 I have given like. 我给了喜欢。

set JAVA_OPTS=-server -Xms512m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=512m -XX:NewSize=192m -XX:MaxNewSize=384m -Djava.awt.headless=true -Dhttp.agent=Sakai -Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false -Dsun.lang.ClassLoader.allowArraySyntax=true

But still the problem exists. 但是问题仍然存在。 Is there anything i need to specify or need to change in the above snippet so that my server will go up. 我需要在上述代码段中指定或更改任何内容,以便服务器正常运行。

Thanks, Jeyaa. 谢谢Jeyaa。

Since you are deploying Sakai, these JAVA_OPTS should be all you need for a small install, as they are what I have used for a number of years: 由于您正在部署Sakai,因此这些JAVA_OPTS应该是小型安装所需的全部,因为它们是我多年使用的:

-server -XX:+UseParallelGC -Xmx1024m -XX:PermSize=512m -XX:MaxPermSize=512m -Djava.awt.headless=true -Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false -Dsun.lang.ClassLoader.allowArraySyntax=true -Dhttp.agent=Sakai -服务器-XX:+ UseParallelGC -Xmx1024m -XX:PermSize = 512m -XX:MaxPermSize = 512m -Djava.awt.headless = true -Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING = false -Dsun.lang.ClassLoader。 allowArraySyntax = true -Dhttp.agent =酒井

Note that what you want for your particular issue is to increase the PermSize settings. 请注意,您要解决的特定问题是增加PermSize设置。

Your best bet, if you're using a Sun JVM, is to download Visual VM 1.3.3 and install all the plugins. 如果您使用的是Sun JVM,最好的选择是下载Visual VM 1.3.3并安装所有插件。 It'll let you see threads, memory , etc. 它会让您看到线程,内存等。

Start Visual VM first, then start Tomcat by selecting its JRE in Visual VM. 首先启动Visual VM,然后通过在Visual VM中选择其JRE启动Tomcat。 You'll be able to see what's going on then. 您将能够看到发生了什么。

You have a lot of memory there. 你在那里有很多记忆。 You must be doing something in your code to make this happen. 您必须在代码中做一些事情才能实现这一目标。

我建议您使用Java HotSpot发行版中包含的工具JVisualVM来检查PermGen空间大小并查看GC统计信息

Try doubling the MaxPermSize with -XX:MaxPermSize=1024m . 尝试使用-XX:MaxPermSize=1024m将MaxPermSize加倍。 If the problem persists, then also try enabling heap-dumping on OutOfMemoryError with the -XX:+HeapDumpOnOutOfMemoryError flag, and then open the memory dump with Eclipse Memory Analyser to figure out what is taking up all that memory. 如果问题仍然存在,则还可以尝试使用-XX:+HeapDumpOnOutOfMemoryError标志在OutOfMemoryError上启用堆转储,然后使用Eclipse Memory Analyzer打开内存转储以找出占用了所有内存的内存。 The memory dumping takes a long time, so be patient. 内存转储需要很长时间,因此请耐心等待。 It could be that you have a leak that needs to be plugged. 可能是您需要堵漏。 For instance, classes being endlessly generated, or lots of Strings being intern 'ed. 例如,无休止地生成类,或者对intern大量的String编辑。

I once had a memory leak because I created Log4J loggers from dynamically generated Strings, and it turned out that Log4J interned all those strings. 曾经有一次内存泄漏,因为我是根据动态生成的字符串创建Log4J记录器的,结果证明Log4J会插入所有这些字符串。 This meant that our program crashed with OOM in the PermGen space after running for 3 days. 这意味着我们的程序运行3天后在PermGen空间中因OOM崩溃。 Not good. 不好。

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

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