Usage
Depending on the JDK version, java by default uses the lesser of 1/4 of the system memory or 1 (or 2) gigabyte(s) of RAM for its heap memory. So, when using java with programs that require more memory, you may want to specify the min and max heap sizes. You can do that by providing appropriate command line arguments to java/javac, for example:
java -Xms128m -Xmx1024m -jar your_java_program.jar
_JAVA_OPTIONS environment variable:
export _JAVA_OPTIONS="-Xms128m -Xmx1024m"
The above options are set when you load the jdk module, so must be modified after loading the module.
Unfortunately, the _JAVA_OPTIONS environment variable overrides the command line -Xms and -Xmx switches instead of the other way around, so if you want to have direct control of the Java Heap Memory settings for every command you will need to make sure the _JAVA_OPTIONS variable is not set before you run the command that uses -Xms and -Xmx.
To check the current value of the _JAVA_OPTIONS environment variable, run:
echo $_JAVA_OPTIONS
_JAVA_OPTIONS environment variable, run:
unset _JAVA_OPTIONS`.