简体   繁体   English

增加permgen空间

[英]Increase permgen space

I am working with tomcat 6.0, and while I am indexing (not while i am starting tomcat), I have a permgen space error. 我正在使用tomcat 6.0,当我正在编制索引时(而不是在我启动tomcat时),我有一个permgen空间错误。
How could I increase that space?? 我怎么能增加那个空间?

Thanks 谢谢

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. 也许你应该考虑改用另一个JVM,比如IBM JVM。 It does not have a Permanent Generation and is immune to this issue. 它没有永久世代,并且不受此问题的影响。

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

You can also increase it via the VM arguments in your IDE. 您还可以通过IDE中的VM参数来增加它。 In my case, I am using Tomcat v7.0 which is running on Eclipse. 就我而言,我使用的是运行在Eclipse上的Tomcat v7.0。 To do this, double click on your server (Tomcat v7.0). 为此,请双击您的服务器(Tomcat v7.0)。 Click the 'Open launch configuration' link. 单击“打开启动配置”链接。 Go to the 'Arguments' tab. 转到“参数”选项卡。 Add -XX:MaxPermSize=512m to the VM arguments list. 将-XX:MaxPermSize = 512m添加到VM参数列表中。 Click 'Apply' and then 'OK'. 单击“应用”,然后单击“确定”。 Restart your server. 重启服务器。

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监视器

Click the Java tab and add the arguments.restart tomcat 单击Java选项卡并添加arguments.restart tomcat

在类似Debian的发行版中,你在/etc/default/tomcat[67]

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

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