Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/304.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java程序无法映射本机内存分配_Java_Heap - Fatal编程技术网

Java程序无法映射本机内存分配

Java程序无法映射本机内存分配,java,heap,Java,Heap,即使有足够的RAM可用,Java程序也无法分配本机内存 程序在操作系统提交异常失败后反复崩溃 任何更新以优化Java堆等的建议 # # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (mmap) failed to map 12288 bytes for committing reserved memory. # Possible reas

即使有足够的RAM可用,Java程序也无法分配本机内存

程序在操作系统提交异常失败后反复崩溃

任何更新以优化Java堆等的建议

#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 12288 bytes for committing reserved memory.
# Possible reasons:
#   The system is out of physical RAM or swap space
#   In 32 bit mode, the process size limit was hit
# Possible solutions:
#   Reduce memory load on the system
#   Increase physical memory or swap space
#   Check if swap backing store is full
#   Use 64 bit Java on a 64 bit OS
#   Decrease Java heap size (-Xmx/-Xms)
#   Decrease number of Java threads
#   Decrease Java thread stack sizes (-Xss)
#   Set larger code cache with -XX:ReservedCodeCacheSize=
# This output file may be truncated or incomplete.
#
#  Out of Memory Error (os_linux.cpp:2627), pid=35462, tid=140393234093824
#
# JRE version: Java(TM) SE Runtime Environment (8.0_65-b17) (build 1.8.0_65-b17)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.65-b01 mixed mode linux-amd64 compressed oops)
# Core dump written. Default location: /usr/hdp/share/hst/activity-analyzer/core or core.35462
#
根据日志,您可以看到有足够的可用内存

Memory: 4k page, physical 264266920k(135968600k free), swap 8393468k(8393468k free)

vm_info: Java HotSpot(TM) 64-Bit Server VM (25.65-b01) for linux-amd64 JRE (1.8.0_65-b17), built on Oct  6 2015 17:16:12 by "java_re" with gcc 4.3.0 20080428 (Red Hat 4.3.0-8)

time: Tue Feb  5 05:54:26 2019
elapsed time: 2928 seconds (0d 0h 48m 48s)
资源利用

# free -mg
             total       used       free     shared    buffers     cached
Mem:           252        134        117          0          0         25
-/+ buffers/cache:        108        143
Swap:            8          0          8
JMap输出

# jmap -heap 2820
Attaching to process ID 2820, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.65-b01

using thread-local object allocation.
Parallel GC with 33 thread(s)

Heap Configuration:
   MinHeapFreeRatio         = 0
   MaxHeapFreeRatio         = 100
   MaxHeapSize              = 33554432000 (32000.0MB)
   NewSize                  = 44564480 (42.5MB)
   MaxNewSize               = 11184635904 (10666.5MB)
   OldSize                  = 89653248 (85.5MB)
   NewRatio                 = 2
   SurvivorRatio            = 8
   MetaspaceSize            = 21807104 (20.796875MB)
   CompressedClassSpaceSize = 1073741824 (1024.0MB)
   MaxMetaspaceSize         = 17592186044415 MB
   G1HeapRegionSize         = 0 (0.0MB)

Heap Usage:
PS Young Generation
Eden Space:
   capacity = 9320267776 (8888.5MB)
   used     = 7558977896 (7208.803077697754MB)
   free     = 1761289880 (1679.696922302246MB)
   81.10258286209995% used
From Space:
   capacity = 262668288 (250.5MB)
   used     = 242645032 (231.40433502197266MB)
   free     = 20023256 (19.095664978027344MB)
   92.37698004869168% used
To Space:
   capacity = 346030080 (330.0MB)
   used     = 0 (0.0MB)
   free     = 346030080 (330.0MB)
   0.0% used
PS Old Generation
   capacity = 715653120 (682.5MB)
   used     = 395523640 (377.2007369995117MB)
   free     = 320129480 (305.2992630004883MB)
   55.267507252675706% used

22626 interned Strings occupying 2218928 bytes.
Java版本

# java -version
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
红帽释放

# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.6 (Santiago)

您可能受到以下因素的影响:

根据《华盛顿邮报》建议的解决办法:

这里有两种可能的解决方法

  • 禁用压缩OOP(-XX:-UseCompressedOops),性能会受到轻微的影响。这将指示JVM在没有 压缩的Oops特性,它不会尝试将Java堆放入 堆的前4GB
  • 保留CompressedOops并使用JVM选项-XX:HeapBaseMinAddress=n设置Java堆的基址,以指定 Java堆应该从开始将其设置为更高的地址,以便 有足够的空间给本地的马洛克人吗

  • 您是否使用任何jvm参数?您使用的是什么操作系统和体系结构?您使用的是哪个JRE?更新了Post。有人知道为什么它会说“在32位模式下,进程大小限制已达到”,但当指定VM版本时,表示您使用的是64位服务器(“Java VM:Java HotSpot(TM)64位服务器”)?这些信息似乎相互矛盾。我也遇到了同样的问题,使用Java 8.0_181-B13时的字节数(12288)与此相同。该错误适用于8u131版本。OP使用的是不同的版本。这还相关吗?(我也在使用不同的版本)。