openjdk team mailing list archive
-
openjdk team
-
Mailing list archive
-
Message #06993
Bug#652295: openjdk-6: JRE defaults heap to 1/4 total ram, so can fail with a ulimit in force
Package: openjdk-6
Severity: normal
Java uses 1/4 ( MaxRAMFraction [1]) of the _physical_ memory as heap
(Arguments::set_heap_size() [2]). If there is any limit pushing java
below this, for example a ulimit, it will fail. The failure could also
be cause in a virtualised situation for example using OpenVZ where the
kernel will report the total memory, but the partition has a limit of
less than 1/4 of that.
The only reasonable workaround is to pass the "-Xmx" option whenever
you run Java, but this isn't set when installing the
openjdk-6-jre-headless package, so even setting that package up can
fail with:
Could not create the Java virtual machine.
Error occurred during initialization of VM
Could not reserve enough space for object heap
I'm not sure of the best course of action to solve this - it seems like
the nicest thing would be to look at the limit using the ulimit
interface and reduce the default to a bit less than that (to allow for
things other than the heap itself).
[1] http://hg.openjdk.java.net/jdk6/jdk6/hotspot/file/8389681cd7b1/src/share/vm/runtime/globals.hpp
[2] http://hg.openjdk.java.net/jdk6/jdk6/hotspot/file/8389681cd7b1/src/share/vm/runtime/arguments.cpp