Will CodeCache in JVM be flushed if -XX:+UseCodeCacheFlushing is not used?

6.8k Views Asked by At

I was monitoring the javaDB(derby) using jconsole, my java version is 1.6.0_27.

As I read in this article, CodeCache is full. Compiler has been disabled:

  • I thought the CodeCache will not be flushed without -XX:+UseCodeCacheFlushing
  • -XX:+UseCodeCacheFlushing is not automatically turned on until 1.7.0_4.

But the jconsole shows the CodeCache usage falls down, which surprised me:

CodeCache Usage Falls Down

Is there any explanation for this? What is in CodeCache besides the JIT compiled method?

1

There are 1 best solutions below

0
On

The reason maybe is still the option:UseCodeCacheFlushing=true. The default config of 3 version JDK below:

$ java -XX:+PrintFlagsFinal -version | grep CodeCacheFlush
 bool UseCodeCacheFlushing                      = true                                {product}

java version "1.8.0_25" Java(TM) SE Runtime Environment (build 1.8.0_25-b18) Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

$ ./java -XX:+PrintFlagsFinal -version | grep CodeCacheFlush
uintx CodeCacheFlushingMinimumFreeSpace         = 1536000         {product}
 intx MinCodeCacheFlushingInterval              = 30              {product}
 bool UseCodeCacheFlushing                      = true            {product}

java version "1.7.0_79" Java(TM) SE Runtime Environment (build 1.7.0_79-b15) Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

$ java -XX:+PrintFlagsFinal -version | grep CodeCacheFlush
uintx CodeCacheFlushingMinimumFreeSpace         = 1536000         {product}           
 intx MinCodeCacheFlushingInterval              = 30              {product}           
 bool UseCodeCacheFlushing                      = true            {product}           

java version "1.7.0_51" Java(TM) SE Runtime Environment (build 1.7.0_51-b13) Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)