安裝了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