ReservedCodeCacheSize 和 InitialCodeCacheSize 是什么?
谁能解释一下JVM选项 ReservedCodeCacheSize
和 InitialCodeCacheSize
是什么?具体来说,我何时/为什么要更改它?如何确定合适的尺寸?
Can someone please explain what the JVM option ReservedCodeCacheSize
and InitialCodeCacheSize
are? Specifically when/why would I want to change it? How do I decide what the right size is?
这是文档所说的:
-XX:ReservedCodeCacheSize=32m 保留代码缓存大小(以字节为单位)- 最大代码缓存大小.[Solaris 64 位、amd64 和 -server x86:2048m;在 1.5.0_06 及更早版本中,Solaris 64 位和 and64:1024m.]
-XX:ReservedCodeCacheSize=32m Reserved code cache size (in bytes) - maximum code cache size. [Solaris 64-bit, amd64, and -server x86: 2048m; in 1.5.0_06 and earlier, Solaris 64-bit and and64: 1024m.]
推荐答案
ReservedCodeCacheSize
(和 InitialCodeCacheSize
)是(即时)编译器的一个选项Java 热点虚拟机.基本上它设置编译器代码缓存的最大大小.
ReservedCodeCacheSize
(and InitialCodeCacheSize
) is an option for the (just-in-time) compiler of the Java Hotspot VM. Basically it sets the maximum size for the compiler's code cache.
缓存可能已满,这会导致如下警告:
The cache can become full, which results in warnings like the following:
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 警告:异常 java.lang.OutOfMemoryError 将信号 SIGINT 分派给处理程序时,情况会更糟——VM 可能需要强制终止
.
何时设置此选项?
- 当热点编译器失败时
- 减少 JVM 所需的内存(因此有 JIT 编译器失败的风险)
通常您不会更改此值.我认为默认值非常平衡,因为这个问题仅在极少数情况下发生(根据我的经验).
Normally you'd not change this value. I think the default values are quite good balanced because this problems occur on very rare occasions only (in my experince).
相关文章