Post navigation

Java HotSpot(TM) 64-Bit Server VM warning: Failed to reserve shared memory (errno = 12)

I was configuring Apache Tomcat on 64-Bit Linux OS and wanted to tune it for better performance. While searching the net for the same I came across JVM Performance Tuning by Andrig Miller its good start for tuning Java for better performance on machine with Large memory.

Everything went fine but for some reason the process was not able to make the use of HugePages. Did lot of googling but was able to find the answer why it was not using it and to top it up whenever I use to shut down the server I use to get following error:

Java HotSpot(TM) 64-Bit Server VM warning: Failed to reserve shared memory (errno = 12)

Hence tried to do the research on my own. First thing I did is reduce the heap size that I had defined by 1 GB which resolved both the issues (Initially I have define the heap size same as memlock defined in /etc/security/limits.conf). Other thing that you can do is set the memlock to unlimited. Thanks to Andrig Miller for the suggestion.

Edit /etc/security/limits.conf and change the memlock as follows:

soft memlock unlimited
hard memlock unlimited

Conclusion: Keep the Heap Size less than the memlock defined in /etc/security/limits.conf. Or set the memlock to unlimited in /etc/security/limits.conf

This entry was posted in Application Server and tagged , , , , , , , , by Mohan Cheema. Bookmark the permalink.

2 thoughts on “Java HotSpot(TM) 64-Bit Server VM warning: Failed to reserve shared memory (errno = 12)

  1. I have change it to unlimited,but the error repeat.

  2. Hi,

    Can you post the content of your limits.conf, output of ulimit -a and memory you have assigned to your JVM.

    Regards,

    Mohan

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CommentLuv badgeShow more posts

(Spamcheck Enabled)