Java -XX:-PrintGC 和 XX:-PrintGCDetails 标志有什么作用?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1815390/
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
What do -XX:-PrintGC and XX:-PrintGCDetails flags do?
提问by ripper234
采纳答案by David Rabinowitz
Setting this flags writes all the garbage collections made by the JVM to a log file (or stdout, but then it is less useful), and these can be analysed by tools such as the ones mentioned here. Using this information you can fine tune your garbage collection configuration.
设置此标志会将 JVM 进行的所有垃圾收集写入日志文件(或标准输出,但它不太有用),这些可以通过诸如此处提到的工具进行分析。使用此信息,您可以微调垃圾收集配置。
回答by Jé Queue
Rather on Sun's, use -Xloggc:gc.log
to log to a file, -verbose:gc
is also a common switch for this.
而在 Sun 上,用于-Xloggc:gc.log
登录到文件,-verbose:gc
也是一个常见的开关。
Also, ensure -XX:+PrintGCDetails
and -XX:+PrintGCTimeStamps
(note the plus + sign). The timestamp switch is redundant but good to include.
另外,确保-XX:+PrintGCDetails
和-XX:+PrintGCTimeStamps
(注意加号 + 号)。时间戳开关是多余的,但很好包含在内。