This option sets the maximum limit for the total JIT code cache size based on the amount of physical memory available to the VM.


Setting Value Default
<number> Between 1 and 100 (fractional numbers are allowed) 25

Where <number> is the maximum limit that is expressed as a percentage of the available physical memory.

For example, if you specify -XX:codecachetotalMaxRAMPercentage=30, the VM is not allowed to use more than 30% of the available physical memory for the internal JIT code caches.


The default total size of the JIT code cache is computed as the minimum of the following two limits:

In memory constrained environments, the percentage limit is relevant because the code cache size is then based on the available physical memory. The percentage limit prevents the VM from using too much memory for its code caches and thus, leaving too little memory for other VM or JIT data structures.

For example, on a 64-bit system, the platform-specific code cache limit is 256 MB. If the VM is constrained to less than 1024 MB, say 512 MB, then the code cache limit becomes 128 MB (25% of 512 MB) because the percentage limit is less than the platform limit.

To fine-tune the code cache size limit for your specific application as a percentage of the available physical memory, you can use the -XX:codecachetotalMaxRAMPercentage option.

As an alternative, you can use the -XX:codecachetotal or the -Xcodecachetotal options to set the code cache size limit as an absolute value (platform-based limit). The absolute value that is specified with these options takes precedence over the percentage that is specified with the -XX:codecachetotalMaxRAMPercentage option.