如何正确设置 permgen 大小? [英] How do I properly set the permgen size?
问题描述
我有这个带有 tomcat、java 和 grails 的 VM.我一直收到 permgen 错误,所以我环顾四周并找到了解决方案:
I have this VM with tomcat, java, and grails in it. I've been getting permgen errors so I looked around and found the solution:
set JAVA_OPTS="-Xms256m -Xmx1024m -XX:PermSize=512m -XX:MaxPermSize=512m"
我使用 SSH 访问虚拟机并输入上面的参数.我想这会解决问题.问题是,我想确保我做对了.所以我再次搜索如何检查当前的 permSize,这是我得到的解决方案:
I use SSH to access the vm and type the arguments above. I suppose that would fix the problem. Thing is, I wanted to make sure that I did it correctly. So I searched again on how I could check the current permSize and this is the solution I got:
jinfo -flag MaxPermSize 6444
6444 是 pid,作为回应,我得到了这个.
6444 is the pid, and as a response, I got this.
-XX:MaxPermSize=85983232
问题:maxPermSize 的值是以字节为单位吗?因为,如果是,则意味着 java_opts 命令不起作用.我期望得到 512m 但 85983232 字节 = 82 mb .. 还是我看错了..?有人可以启发我吗?:
Question: Is the value of the maxPermSize in bytes? because, if it is, then that would mean that the java_opts command didn't work. I am expecting to get 512m but 85983232 bytes = 82 mb.. Or am I seeing it wrong..? Can anybody enlighten me on this? D:
推荐答案
您必须更改 Tomcat Catalina 启动文件中定义的 CATALINA_OPTS 选项中的值.要增加 PermGen
内存,请更改 MaxPermSize
变量的值,否则更改 Xmx
变量的值.
You have to change the values in the CATALINA_OPTS option defined in the Tomcat Catalina start file. To increase the PermGen
memory change the value of the MaxPermSize
variable, otherwise change the value of the Xmx
variable.
Linux &Mac OS: 打开或创建setenv.sh
文件放在bin"目录中.您必须将更改应用于此行:
Linux & Mac OS: Open or create setenv.sh
file placed in the "bin" directory. You have to apply the changes to this line:
export CATALINA_OPTS="$CATALINA_OPTS -server -Xms256m -Xmx1024m -XX:PermSize=512m -XX:MaxPermSize=512m"
Windows:
打开或创建放在bin"目录下的setenv.bat
文件:
Open or create the setenv.bat
file placed in the "bin" directory:
set CATALINA_OPTS=-server -Xms256m -Xmx1024m -XX:PermSize=512m -XX:MaxPermSize=512m
这篇关于如何正确设置 permgen 大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!