Available JVM Memory

By default the JVM is granted 50% of the total memory available to the gear (see table below). The JVM is not granted 100% of the total available memory to allow other processes to run on the gear including cron, background jobs, and installed cartridges (for non-scaled applications).

Gear Size Total Memory JVM Memory

Small

512MB

256MB

Small.highcpu

512MB

256MB

Medium

1GB

512MB

Large

2GB

1GB

Changing Available JVM Memory

It is possible to allocate more memory to the JVM using the following command:

$ rhc env-set JAVA_OPTS_EXT="-Xmx<memory>m" -a <appname>

Where <memory> is the amount of memory that you would like to make available to the JVM (must be less than or equal to the total amount available to the gear), and <appname> is the name of your application.

After running this command on your local workstation, you will need to stop & start your application using the following commands:

$ rhc app stop <appname>
$ rhc app start <appname>

The JAVA_OPTS_EXT environment variable allows you to append to the default JAVA_OPTS that are passed when invoking the JVM. Since your new options will be places after the defaults, they will be the ones that get used. You can learn more about the JAVA_OPTS_EXT environment variable in the Environment Variables guide.