Chapter 2 – JIT, Hotspot, and GraalJIT
- A code cache is a special memory area within JVM that is used by JVM to store the compiled code. The code is compiled by JIT compilers and stored in the code cache. If a method is compiled and is found in the code cache, JVM will use that code to run, instead of interpreting the method code. Refer to the Code cache section for more details
- The code cache size can be changed using the following flags for fine-tuning. Refer to the Code cache section for more details:
a.
-XX:InitialCodeCacheSize
– The initial size of the code cache. The default size is 160 KB (the size varies based on the JVM version)b.
-XX:ReservedCodeCacheSize
– This is the maximum size the code cache can grow to. The default size is 32/48 MB. When the code cache reaches this limit, JVM will throw a warning,CodeCache is full. Compiler has been disabled.
JVM offers theUseCodeCacheFlushing
option to flush the code cache when the code cache is full....