What is Code Cache?
Code cache is the central component of JVM, and represents an area in memory where JVM stores generated native code.
As part of ‘Segmented Code Cache’ feature, code cache is divided into distinct segments, where each segment contains compiled code of specific type.
There are three different types of compiled code exist.
a. JVM internal (non-method) code
b. Profiled-code
c. Non-profiled code
Corresponding Code heaps for different compiled code types given below.
a. non-method code heap containing non-method code, such as compiler buffers and bytecode interpreter. This code type will stay in the code cache forever. This heap has fixed size of 3MB. The remaining code cache space is distributed evenly among the profiled and the non-profiled code heaps.
b. profiled code heap containing lightly optimized, profiled methods with a short lifetime.
c. non-profiled code heap containing fully optimized, non-profiled methods with a potentially long lifetime.
Can I control code heaps size?
Yes, following table summarizes different options to control code heaps size.
Option |
Description |
-XX:NonMethodCodeHeapSize |
Sets the size in bytes of the code heap containing non-method code. |
-XX:ProfiledCodeHeapSize |
Sets the size in bytes of the code heap containing profiled methods. |
-XX:NonProfiledCodeHeapSize |
Sets the size in bytes of the code heap containing non-profiled methods. |
Reference
https://openjdk.java.net/jeps/197
Previous Next Home
No comments:
Post a Comment