tomcat java.lang.OutOfMemoryError

來源:互聯網
上載者:User

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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.