Java 增加永久空间

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3003855/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 15:29:55  来源:igfitidea点击:

Increase permgen space

javatomcattomcat6permgen

提问by Blanca

I am working with tomcat 6.0, and while I am indexing (not while i am starting tomcat), I have a permgen space error.
How could I increase that space??

我正在使用 tomcat 6.0,当我正在编制索引时(不是在我启动 tomcat 时),我有一个 permgen 空间错误。
我怎么能增加那个空间?

Thanks

谢谢

采纳答案by Peter Tillemans

You can use :

您可以使用 :

-XX:MaxPermSize=128m

to increase the space. But this usually only postpones the inevitable.

以增加空间。但这通常只会推迟不可避免的事情。

You can also enable the PermGen to be garbage collected

您还可以启用 PermGen 进行垃圾收集

-XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled

Usually this occurs when doing lots of redeploys. I am surprised you have it using something like indexing. Use virtualvm or jconsole to monitor the Perm gen space and check it levels off after warming up the indexing.

通常在进行大量重新部署时会发生这种情况。我很惊讶你使用索引之类的东西。使用 virtualvm 或 jconsole 监视 Perm gen 空间并在索引预热后检查它是否稳定。

Maybe you should consider changing to another JVM like the IBM JVM. It does not have a Permanent Generation and is immune to this issue.

也许您应该考虑更改为另一个 JVM,例如 IBM JVM。它没有永久代并且不受此问题的影响。

回答by Paroksh Saxena

For tomcat you can increase the permGem space by using

对于 tomcat,您可以通过使用增加 permGem 空间

 -XX:MaxPermSize=128m

For this you need to create (if not already exists) a file named setenv.sh in tomcat/bin folder and include following line in it

为此,您需要在 tomcat/bin 文件夹中创建(如果尚未存在)一个名为 setenv.sh 的文件,并在其中包含以下行

   export JAVA_OPTS="-XX:MaxPermSize=128m"

Reference : http://wiki.razuna.com/display/ecp/Adjusting+Memory+Settings+for+Tomcat

参考:http: //wiki.razuna.com/display/ecp/Adjusting+Memory+Settings+for+Tomcat

回答by user3375152

You can also increase it via the VM arguments in your IDE. In my case, I am using Tomcat v7.0 which is running on Eclipse. To do this, double click on your server (Tomcat v7.0). Click the 'Open launch configuration' link. Go to the 'Arguments' tab. Add -XX:MaxPermSize=512m to the VM arguments list. Click 'Apply' and then 'OK'. Restart your server.

您还可以通过 IDE 中的 VM 参数增加它。就我而言,我使用的是在 Eclipse 上运行的 Tomcat v7.0。为此,请双击您的服务器 (Tomcat v7.0)。单击“打开启动配置”链接。转到“参数”选项卡。将 -XX:MaxPermSize=512m 添加到 VM 参数列表。单击“应用”,然后单击“确定”。重新启动您的服务器。

回答by Kevin STS

if you found out that the memory settings were not being used and in order to change the memory settings, I used the tomcat7w or tomcat8w in the \bin folder.Then the following should pop up:

如果您发现未使用内存设置并且为了更改内存设置,我使用了 \bin 文件夹中的 tomcat7w 或 tomcat8w。然后应该弹出以下内容:

tomcat monitor

Tomcat监视器

Click the Java tab and add the arguments.restart tomcat

单击 Java 选项卡并添加 arguments.restart tomcat

回答by der_do

On Debian-like distributions you set that in /etc/default/tomcat[67]

在类似 Debian 的发行版上,您将其设置为 /etc/default/tomcat[67]