安装了64位 jdk7_17之后,tomcat 7 总是报内存溢出错误。
调整之后依然不起作用,不得已又换回32位JDK。
调整内存的配置:
export JAVA_OPTS="-server -Xmx1536M -XX:MaxPermSize=512m -Dfile.encoding=UTF-8"
保存为%TOMCAT_HOME%/bin/setenv.bat
参数说明:
-server Select the Java HotSpot Server VM.
For more information, see Server-Class Machine Detection[http://docs.oracle.com/javase/1.5.0/docs/guide/vm/server-class.html]
-Xmxn
Specify the maximum size, in bytes, of the memory allocation pool. This value must a multiple of 1024 greater than 2MB. Append the letter k or K to indicate kilobytes, or m or M to indicate megabytes. The default value is 64MB. Examples:
-Xmx83886080
-Xmx81920k
-Xmx80m
-XX:MaxPermSize=64m
Size of the Permanent Generation. [5.0 and newer: 64 bit VMs are scaled 30% larger; 1.4 amd64: 96m; 1.3.1 -client: 32m.]
-Dproperty=value
Set a system property value. If value is a string that contains spaces, you must enclose the string in double quotes:
java -Dfoo="some string" SomeClass
参考资料:
[1] Artur Ejsmont. http://artur.ejsmont.org/blog/content/fixing-javalangoutofmemoryerror-permgen-out-of-memory-in-grails-sts-and-tomcat
[2] java - the Java application launcher. http://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/java.html
[3] Java HotSpot VM Options. http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html