What is -XX:ReservedCodeCacheSize and why do we need it? Follow


Java 10, 11 only


What is CodeCache and the importance of using -XX:ReservedCodeCacheSize?

The Java Hotspot VM (JVM) compiles code and stores it in native memory in a designated area called CodeCache. That process is used mostly by the "just-in-time" compiler (JIT) as part of improving the performance of the running process.

Using the -XX:ReservedCodeCacheSize flag enables us to control the size reserved for that code cache.


Why do we need to adjust the size of the CodeCache memory?

As our product performs instrumentation, it enlarges the bytecode, thus, creating a bigger consumption of the CodeCache memory. Setting the CodeCache size too small might get it full, causing a performance impact on the running process as new code can't be compiled and stored or needs to be swapped with code which might be used in the future.


What size should I set it to?

Please contact OverOps support with the agent log for the process in question and we can help you determine the correct size.


Additional Information

Why do you need -Xshare:off and -XX:-UseTypeSpeculation for Java 11