问题描述
Java 虚拟机支持多种垃圾收集策略.
这篇文章解释了它们.
现在我想知道我的应用程序正在使用哪种(自动选择的)策略,有没有办法让 JVM(1.6 版)打印这些信息?
JVM 检测它是处于客户端模式还是服务器模式.所以问题真的是我如何才能看到哪些已经被检测到?
http://java.sun.com/j2se/1.5.0/docs/guide/vm/gc-ergonomics.html 也声明默认为并行收集器.
我们仅通过设置在 JVM 1.5 上测试过一次
-server -Xms3g -Xmx3g -XX:PermSize=128m -XX:LargePageSizeInBytes=4m -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps
输出显示
41359.597:[GC [PSYoungGen:90499K->32K(377344K)] 268466K->181862K(2474496K),0.0183138 秒]41359.615:[完整 GC [PSYoungGen:32K->0K(377344K)][PSOldGen:181830K->129760K(2097152K)]181862K->129760K(2474496K)[PSPermGen:115335K->115335K->115335K(45)s.39]其中 PS 代表并行清除
The Java Virtual Machine supports several garbage collection strategies.
This article explains them.
Now I am wondering which (automatically selected) strategy my application is using, is there any way to let the JVM(version 1.6) print this information?
Edit: The JVM detects if it is in client or server mode. So the question really is how can I see which has been detected?
http://java.sun.com/j2se/1.5.0/docs/guide/vm/gc-ergonomics.html which is applicable for J2SE 6 as well states that the default is the Parallel Collector.
We tested this once on a JVM 1.5 by setting only
-server -Xms3g -Xmx3g -XX:PermSize=128m -XX:LargePageSizeInBytes=4m -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps
and the output showed
41359.597: [GC [PSYoungGen: 90499K->32K(377344K)] 268466K->181862K(2474496K), 0.0183138 secs] 41359.615: [Full GC [PSYoungGen: 32K->0K(377344K)] [PSOldGen: 181830K->129760K(2097152K)] 181862K->129760K(2474496K) [PSPermGen: 115335K->115335K(131072K)], 4.4590942 secs]
where PS stands for Parallel Scavenging
这篇关于如何查看 java 正在使用哪个垃圾收集器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!