2014-12-04 213 views
2

如果您查看文档(例如http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html),您会发现XX:SurvivorRatio的默认值为8。Java:为什么没有使用XX的默认值:SurvivorRatio?

如果您检查正在运行的JVM这一直startet没有明确设置一个SurvivorRation你可以看到这个默认:

jmap -heap <pid> 

将输出

... 
SurvivorRatio = 8 
... 

但是,如果你检查S1的最大尺寸S0使用VisualGC,你可以看到使用了SurvivorRatio = 1。

的图片,如果你明确地启动Java PROGRAMM蒙山-XX变化:SurvivorRatio = 8

那么,为什么默认。不使用的默认值非常令人恼火。

回答

4

the BOOK关于Java性能优化:

-XX:SurvivorRatio=<n> should be used when you want to explicitly size survivor 
spaces to manipulate object aging with the concurrent garbage collector, or to 
manipulate object aging with the throughput garbage collector when adaptive sizing 
is disabled using the command line option -XX:-UseAdaptiveSizePolicy. 

所以-XX:SurvivorRatio被忽略,除非你使用-XX:-UseAdaptiveSizePolicy

+1

在我的测试中,使用Linux x64上的Java 8,我可以指定没有其他参数的'-XX:SurvivorRatio',它可以工作。 – 2017-01-11 07:45:54

相关问题