{"id":5450,"date":"2015-12-19T21:42:20","date_gmt":"2015-12-19T13:42:20","guid":{"rendered":"http:\/\/rmohan.com\/?p=5450"},"modified":"2015-12-19T21:42:20","modified_gmt":"2015-12-19T13:42:20","slug":"native-memory-allocation-mmap-failed-to-map-xx-bytes-for-committing-reserved-memory-jdk-1-8-centos-6-7","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=5450","title":{"rendered":"Native memory allocation (mmap) failed to map XX bytes for committing reserved memory \u2013 JDK 1.8 \u2013 CentOS 6.7"},"content":{"rendered":"<p>While trying to check whether java was working I was repeatedly getting the following error:<br \/>\njava -version<\/p>\n<p>#<br \/>\n# There is insufficient memory for the Java Runtime Environment to continue.<br \/>\n# Native memory allocation (mmap) failed to map 2555904 bytes for committing reserved memory.<br \/>\n# Possible reasons:<br \/>\n# The system is out of physical RAM or swap space<br \/>\n# In 32 bit mode, the process size limit was hit<br \/>\nTried increasing memory allocated to the java process, tried a lot of things mentioned by people online but nothing helped. The server had enough ram, 24GB free.<\/p>\n<p>Turn\u2019s out I had to disable MPROTECT as I was on a hardened kernel. To do this first run:<\/p>\n<p>To find out where java is located run:<br \/>\nwhich java<br \/>\nThen:<\/p>\n<p>paxctl -c \/usr\/bin\/java<\/p>\n<p>and finally to disable MPROTECT:<br \/>\npaxctl -m \/usr\/bin\/java<\/p>\n<p>This now allows java to run fine, issuing the java -version command at shell no longer throws an error instead shows the version of Java installed which is what you should actually be seeing.<\/p>\n<p>In case you want to turn MPROTECT back on issue the following:<\/p>\n<p>paxctl -M \/usr\/bin\/java<\/p>\n","protected":false},"excerpt":{"rendered":"<p>While trying to check whether java was working I was repeatedly getting the following error: java -version<\/p>\n<p># # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (mmap) failed to map 2555904 bytes for committing reserved memory. # Possible reasons: # The system is out of physical RAM [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,17],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/5450"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5450"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/5450\/revisions"}],"predecessor-version":[{"id":5451,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/5450\/revisions\/5451"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5450"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5450"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5450"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}