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

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


程序因 os_commit 异常而失败后反复崩溃。


任何更新以调整 Java Heap 等的建议。


#

# 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)


RISEBY
浏览 337回答 1
1回答

浮云间

您可能会受到此影响根据帖子建议的解决方法:这里有两种可能的解决方法禁用压缩的 Oops (-XX:-UseCompressedOops) 会带来轻微的性能损失。这将指示 JVM 在没有 Compressed Oops 功能的情况下运行,并且不会尝试将 Java 堆放入前 4GB 堆中保留 CompressedOops 并使用 JVM 选项 -XX:HeapBaseMinAddress=n 设置 Java Heap 的基址,以指定 Java Heap 应该开始的地址,将其设置为更高的地址,以便有足够的空间可用于本机 malloc
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java