0
我正在使用putty連接虛擬機。那裏我安裝了java8和tomcat8。嘗試運行應用程序使用tomcat作爲遠程服務器獲取404錯誤。「Java HotSpot(TM)64位服務器VM警告:無法保留共享內存。(errno = 12)」
所以我重新啓動了tomcat。在停止服務器時,我收到此錯誤。任何人都可以知道這個解決方案嗎?
我正在使用putty連接虛擬機。那裏我安裝了java8和tomcat8。嘗試運行應用程序使用tomcat作爲遠程服務器獲取404錯誤。「Java HotSpot(TM)64位服務器VM警告:無法保留共享內存。(errno = 12)」
所以我重新啓動了tomcat。在停止服務器時,我收到此錯誤。任何人都可以知道這個解決方案嗎?
無法保留共享內存當JVM無法爲共享內存中的Java堆分配大量頁面時,可能會顯示消息。這可能僅在-XX:+UseLargePages
打開時發生。
errno = 12表示「內存不足」。
解釋從HotSpot sources:
// Possible reasons for shmget failure:
// 1. shmmax is too small for Java heap.
// > check shmmax value: cat /proc/sys/kernel/shmmax
// > increase shmmax value: echo "0xffffffff" > /proc/sys/kernel/shmmax
// 2. not enough large page memory.
// > check available large pages: cat /proc/meminfo
// > increase amount of large pages:
// echo new_value > /proc/sys/vm/nr_hugepages
// Note 1: different Linux may use different name for this property,
// e.g. on Redhat AS-3 it is "hugetlb_pool".
// Note 2: it's possible there's enough physical memory available but
// they are so fragmented after a long run that they can't
// coalesce into large pages. Try to reserve large pages when
// the system is still "fresh".
按照上面的說明或只是刪除-XX:+UseLargePages
JVM選項。