0

I have the similar issue to topic: JVM crashes with error='Cannot allocate memory' (errno=12)

INFO: os::commit_memory(0x00007fbb1b9fa000, 12288, 0) failed; error='Cannot allocate memory' (errno=12) [thread 140441600108288 also had an error]

There is insufficient memory for the Java Runtime Environment to continue. Native memory allocation (mmap) failed to map 12288 bytes for committing reserved memory. An error report file with more information is saved as:

In the hs_err_pid31683.log I have:

proc/meminfo:
MemTotal:       32943108 kB
MemFree:          173012 kB
MemAvailable:          0 kB
Buffers:               0 kB
Cached:          1546468 kB
SwapCached:            0 kB
Active:         31708256 kB
Inactive:         489932 kB
Active(anon):   31708096 kB
Inactive(anon):   489932 kB
Active(file):        160 kB
Inactive(file):        0 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:               596 kB
Writeback:             4 kB
AnonPages:      30657632 kB
Mapped:            50988 kB
Shmem:           1541208 kB
Slab:             145404 kB
SReclaimable:      45000 kB
SUnreclaim:       100404 kB
KernelStack:       18304 kB
PageTables:        72900 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:    16471552 kB
Committed_AS:   31484736 kB
VmallocTotal:   34359738367 kB
VmallocUsed:      208124 kB
VmallocChunk:   34336882684 kB
HardwareCorrupted:     0 kB
AnonHugePages:   8165376 kB
CmaTotal:              0 kB
CmaFree:               0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:      178048 kB
DirectMap2M:     9259008 kB
DirectMap1G:    26214400 kB

and:

Memory: 4k page, physical 32943108k(174536k free), swap 0k(0k free)

So, I have 32943108 kB of total memory and 174536k available memory. JVM trying to allocate 12288 bytes (12k), so it seems to be enough memory.

In Xmx configuration it's declared 28g, so comparing it to total memory is still enough (4g available).

wrapper.java.additional.5=-Xmx25g wrapper.java.additional.6=-XX:MaxMetaspaceSize=3g

Someone has some good advice. What causes a problem and how to fix that?

witosh
  • 79
  • 3
  • native memory != heap. – Eugene Feb 12 '20 at 17:22
  • The error message is quite clear: you need to reduce JVM memory usage or to increase RAM. JVM memory usage is NOT limited only by `Xmx` + `MaxMetaspaceSize`, see [this answer](https://stackoverflow.com/questions/53451103/java-using-much-more-memory-than-heap-size-or-size-correctly-docker-memory-limi/53624438#53624438) for details. – apangin Feb 12 '20 at 17:24

0 Answers0