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
CMSPermGenSweepingEnabled vs CMSClassUnloadingEnabled
提问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:+CMSPermGenSweepingEnabled
flag set, the following message is printed:
如果我在-XX:+CMSPermGenSweepingEnabled
设置了标志的情况下启动 Java VM,则会打印以下消息:
Please use CMSClassUnloadingEnabled in place of CMSPermGenSweepingEnabled in the future
以后请使用 CMSClassUnloadingEnabled 代替 CMSPermGenSweepingEnabled
The -XX:+CMSPermGenSweepingEnabled
flag is often used to mitigate against PermGen OutOfMemory
errors, 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:+CMSPermGenSweepingEnabled
as well as -XX:+CMSClassUnloadingEnabled
their VM has stayed up longer between restarts.
该-XX:+CMSPermGenSweepingEnabled
标志通常用于减轻PermGen OutOfMemory
错误,但是我在其他地方读到过,人们发现通过遵循上述建议,他们仍然有这些错误,但是通过坚持-XX:+CMSPermGenSweepingEnabled
以及-XX:+CMSClassUnloadingEnabled
他们的 VM 在重新启动之间保持更长的时间。
Does -XX:+CMSClassUnloadingEnabled
really supersede -XX:+CMSPermGenSweepingEnabled
or 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 CMSPermGenSweepingEnabled
is to print that message - it's not processed the way it is in 1.5. For CMSClassUnloadingEnabled
to have any impact, UseConcMarkSweepGC
must also be set.
据我所知,1.6 JVM 所做的唯一一件事CMSPermGenSweepingEnabled
就是打印该消息——它没有按照 1.5 中的方式进行处理。对于CMSClassUnloadingEnabled
要产生任何影响,UseConcMarkSweepGC
还必须设置。