'Cannot allocate memory' (errno=12)' errors during runtime of Java application

20,757

As Platypus suggested in the comments to my question, I downgraded Java to version 1.7.0_41. Unfortunately the problem persisted.

I went even farther back to version 1.7.0_25 and apparently this solved the error. I tried it many times and the error message didn't occur a single more time.

Share:
20,757
Björn Jacobs
Author by

Björn Jacobs

IT Consultant, Data Engineer at codecentric AG Loves developing scalable, high-performance and distributed applications using functional programming techniques with Scala or Java.

Updated on July 09, 2022

Comments

  • Björn Jacobs
    Björn Jacobs almost 2 years

    While running a distributed application, I get a lot of these errors on the server as well as on the worker nodes:

    Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00007f4f8c800000, 549453824, 2097152, 0) failed; error='Cannot allocate memory' (errno=12)
    

    Most of the time the process continues and finishes as expected but sometimes the process also fails.

    I am calling my application with java -Xms512M -Xmx50G -cp myjar.jar myclass.Main

    The nodes have 128 GBs of RAM where about 120 GBs are free.

    I'm using the Oracle JVM:

    $ java -version
    java version "1.7.0_45"
    Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
    Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
    

    What do these messages mean and how can I get rid of them?

  • Rahul Shardha
    Rahul Shardha over 10 years
    Glad I could help. Do you have any details on why the version change fixed the issue?
  • Björn Jacobs
    Björn Jacobs over 10 years
    Unfortunately, I don't. If the problem persists in future Java versions, I'll report a bug to Oracle.