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

2024-03-09

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

所以我重新启动了tomcat。停止服务器时我收到此错误。谁能知道这个问题的解决方案吗?


无法保留共享内存当 JVM 无法从共享内存为 Java 堆分配大页时,可能会出现此消息。这可能仅发生在-XX:+UseLargePages is on.

errno=12意思是“内存不足”。

解释来自热点来源 http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/file/aa4ffb1f30c9/src/os/linux/vm/os_linux.cpp#l3582:

// 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:+UseLargePagesJVM 选项。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

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

随机推荐