“ Java HotSpot(TM)64位服务器VM警告:无法保留共享内存。(errno = 12)”

Ram*_*ddy 0 java tomcat jvm

我正在用腻子连接虚拟机。在那里,我已经安装了java8和tomcat8。尝试使用tomcat作为远程服务器运行应用程序时出现404错误。

所以我重新启动了tomcat。停止服务器时出现此错误。谁能知道解决方案?

apa*_*gin 5

当JVM无法从共享内存为Java堆分配大页面时,可能会出现未能保留共享内存的消息。仅在-XX:+UseLargePages打开时可能会发生这种情况。

errno = 12表示“内存不足”。

来自HotSpot来源的说明:

// 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".
Run Code Online (Sandbox Code Playgroud)

请按照上面的说明进行操作,或者只是删除-XX:+UseLargePagesJVM选项。