Java CMSPermGenSweepingEnabled 对比 CMSClassUnloadingEnabled

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3717937/
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-14 03:52:28  来源:igfitidea点击:

CMSPermGenSweepingEnabled vs CMSClassUnloadingEnabled

javajvm-arguments

提问by Rich

I've kind of asked this question before - What does JVM flag CMSClassUnloadingEnabled actually do?, but this time it's slightly different!

我以前问过这个问题 - JVM 标志 CMSClassUnloadingEnabled 实际上是做什么的?,不过这次略有不同!

If I start a Java VM with the -XX:+CMSPermGenSweepingEnabledflag set, the following message is printed:

如果我在-XX:+CMSPermGenSweepingEnabled设置了标志的情况下启动 Java VM,则会打印以下消息:

Please use CMSClassUnloadingEnabled in place of CMSPermGenSweepingEnabled in the future

以后请使用 CMSClassUnloadingEnabled 代替 CMSPermGenSweepingEnabled

The -XX:+CMSPermGenSweepingEnabledflag is often used to mitigate against PermGen OutOfMemoryerrors, however I have read elsewherethat people have found that by following the above advice they have still had these errors, but by sticking with -XX:+CMSPermGenSweepingEnabledas well as -XX:+CMSClassUnloadingEnabledtheir VM has stayed up longer between restarts.

-XX:+CMSPermGenSweepingEnabled标志通常用于减轻PermGen OutOfMemory错误,但是我在其他地方读到过,人们发现通过遵循上述建议,他们仍然有这些错误,但是通过坚持-XX:+CMSPermGenSweepingEnabled以及-XX:+CMSClassUnloadingEnabled他们的 VM 在重新启动之间保持更长的时间。

Does -XX:+CMSClassUnloadingEnabledreally supersede -XX:+CMSPermGenSweepingEnabledor is there still some benefit in having them both?

难道-XX:+CMSClassUnloadingEnabled真的优先于-XX:+CMSPermGenSweepingEnabled或者是仍然在他俩都有些什么好处?

Thanks in advance

提前致谢

Rich ps: I know that the root cause of perm gen issues is still usually Classloader leaks, this is more about the message that the JVM produces if we use the above options.

Rich ps:我知道perm gen问题的根本原因通常仍然是Classloader泄漏,这更多是关于如果我们使用上述选项JVM产生的消息。

采纳答案by kschneid

From what I can tell, the only thing that the 1.6 JVM does with CMSPermGenSweepingEnabledis to print that message - it's not processed the way it is in 1.5. For CMSClassUnloadingEnabledto have any impact, UseConcMarkSweepGCmust also be set.

据我所知,1.6 JVM 所做的唯一一件事CMSPermGenSweepingEnabled就是打印该消息——它没有按照 1.5 中的方式进行处理。对于CMSClassUnloadingEnabled要产生任何影响,UseConcMarkSweepGC还必须设置。