ReservedCodeCacheSize
(and ) 是 Java Hotspot VM 的(即时)编译器的一个选项。基本上,它设置编译器代码缓存的最大大小。InitialCodeCacheSize
缓存可能会变满,从而导致如下警告:
Java HotSpot(TM) 64-Bit Server VM warning: CodeCache is full. Compiler has been disabled.
Java HotSpot(TM) 64-Bit Server VM warning: Try increasing the code cache size using -XX:ReservedCodeCacheSize=
Code Cache [0x000000010958f000, 0x000000010c52f000, 0x000000010c58f000)
total_blobs=15406 nmethods=14989 adapters=362 free_code_cache=835Kb largest_free_block=449792
当后面跟着 .Java HotSpot(TM) Client VM warning: Exception java.lang.OutOfMemoryError occurred dispatching signal SIGINT to handler- the VM may need to be forcibly terminated
何时设置此选项?
- 热点编译器失败时
- 以减少 JVM 所需的内存(从而冒着 JIT 编译器失败的风险)
通常不会更改此值。我认为默认值是相当平衡的,因为这个问题只在非常罕见的情况下发生(在我的经验中)。