How to disable JVM large page support

from http://www.oracle.com/technetwork/java/javase/7u51-relnotes-2085002.html

Area: hotspot/gc
Synopsis: Crashes due to failure to allocate large pages.

On Linux, failures when allocating large pages can lead to crashes. When running JDK 7u51 or later versions, the issue can be recognized in two ways:

  • Before the crash happens one or more lines similar to this will have been printed to the log:os::commit_memory(0x00000006b1600000, 352321536, 2097152, 0) failed;
    error='Cannot allocate memory' (errno=12); Cannot allocate large pages, falling back to regular pages
  • If a hs_err file is generated it will contain a line similar to this:Large page allocation failures have occurred 3 times

The problem can be avoided by running with large page support turned off, for example by passing the "-XX:-UseLargePages" option to the java binary.


If you cannot set this on your command line, you can set this value to JAVA_TOOL_OPTIONS environment variable: export JAVA_TOOL_OPTIONS=”-XX:-UseLargePages”

Advertisements

A good post discussing JVM cannot allocate memory (errno=12)

http://bryanmarty.com/2012/01/14/forking-jvm/

To enable over-commit temporarily:

echo 1 > /proc/sys/vm/overcommit_memory

For a more permeant solution, you will need to edit /etc/sysctl.conf and add the following:

vm.overcommit_memory = 1

Now just restart your system for the change to take effect.