My java app crashed after running for 3 days with following information:

# 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=99975, tid=139586429245184
# JRE version: Java(TM) SE Runtime Environment (8.0_71-b15) (build 1.8.0_71-b15)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.71-b15 mixed mode linux-amd64 compressed oops)

---------------  S Y S T E M  ---------------

OS:CentOS release 6.8 (Final)

uname:Linux 2.6.32-642.el6.x86_64 #1 SMP Tue May 10 17:27:01 UTC 2016 x86_64
libc:glibc 2.12 NPTL 2.12
rlimit: STACK 10240k, CORE 0k, NPROC 257504, NOFILE 40000, AS infinity
load average:1.67 1.68 1.80

MemTotal:       65949688 kB
MemFree:         5425348 kB
Buffers:          772908 kB
Cached:         39944288 kB
SwapCached:         2516 kB
Active:         43029364 kB
Inactive:       13286372 kB
Active(anon):   15486952 kB
Inactive(anon):   114364 kB
Active(file):   27542412 kB
Inactive(file): 13172008 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:      104856572 kB
SwapFree:       104835232 kB
Dirty:              9552 kB
Writeback:             0 kB
AnonPages:      15598604 kB
Mapped:            61676 kB
Shmem:              1940 kB
Slab:            3052564 kB
SReclaimable:    2664740 kB
SUnreclaim:       387824 kB
KernelStack:      529136 kB
PageTables:       124552 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:    137831416 kB
Committed_AS:   49126512 kB
VmallocTotal:   34359738367 kB
VmallocUsed:      172792 kB
VmallocChunk:   34359446312 kB
HardwareCorrupted:     0 kB
AnonHugePages:  14301184 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:        5988 kB
DirectMap2M:     2091008 kB
DirectMap1G:    65011712 kB

I don't understand why it's running out of memory. I set -Xmx16G.
My understanding is, available memory = free + cached, so it should have plenty of available memory, right?
The app is running in a VM (Nutanix AHV). I read on this link's answer that caching only works well on real machine, is it true?

Any other possibilities on why is this happening?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.