Java -XX:+UseConcMarkSweepGC(默认年轻代收集器是什么?)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20498651/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 02:22:03  来源:igfitidea点击:

-XX:+UseConcMarkSweepGC (what is default young generation collector?)

javagarbage-collectionconcurrent-mark-sweep

提问by Anton Kasianchuk

As far as I know we can run JVM with the next options:

据我所知,我们可以使用以下选项运行 JVM:

-XX:+UseConcMarkSweepGC
-XX:-UseParNewGC

in this case we will have the Serial (DefNew)garbage collector for the young generation and the Concurrent Mark Sweepgarbage collector for the old generation.

在这种情况下,我们将为年轻代使用串行(DefNew)垃圾收集器,为年老代使用并发标记扫描垃圾收集器。

Well, can we run JVM with -XX:+UseConcMarkSweepGCoption only? I mean without any options that describes a garbage collector for the young generation. If we can do that, which garbage collector will be used for the old generation?

那么,我们-XX:+UseConcMarkSweepGC可以只用选项运行 JVM吗?我的意思是没有任何描述年轻代垃圾收集器的选项。如果可以的话,老年代会使用哪个垃圾回收器?

采纳答案by Rafael Winterhalter

According to this blog entry:

根据此博客条目

Note that with recent JVM versions -XX:+UseParNewGCis enabled automatically when -XX:+UseConcMarkSweepGCis set. As a consequence, if parallel young generation GC is not desired, it needs to be disabled by setting -XX:-UseParNewGC.

请注意,使用最新的 JVM 版本-XX:+UseParNewGC会在-XX:+UseConcMarkSweepGC设置时自动启用。因此,如果不需要并行年轻代 GC,则需要通过设置禁用它-XX:-UseParNewGC

For a concise summary of command line combinations, you might also be interested in this overview.

有关命令行组合的简明摘要,您可能还对本概述感兴趣。