-XX:+ PrintTenuringDistribution VM选项应强制VM在幸存者空间中打印对象年龄,如VMOptions page中所述。
但是,当我设置此选项时,我只会看到为每个GC打印的阈值,而不是终身年龄信息。
问:有谁知道为什么这个选项不起作用?
我的VM选项的完整列表:
-XX:+PrintTenuringDistribution -XX:+UnlockDiagnosticVMOptions -XX:+LogVMOutput
-XX:LogFile=jvm.log -server -XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC
-Xloggc:bin/gc.log -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -showversion
-XX:+PrintClassHistogramBeforeFullGC -XX:+PrintClassHistogramAfterFullGC
-XX:+UseParallelOldGC -XX:ParallelGCThreads=4 -XX:MaxTenuringThreshold=15
-XX:NewRatio=2 -XX:InitialSurvivorRatio=3 -XX:SurvivorRatio=3 -XX:TargetSurvivorRatio=90
-Xms8g -Xmx8g -XX:PermSize=512m -Xss256k -XX:MaxPermSize=512m -XX:+UseLargePages
-XX:+AggressiveOpts -server -XX:-UseBiasedLocking
我的Java版本是:
java version "1.6.0_21"
Java(TM) SE Runtime Environment (build 1.6.0_21-b06)
Java HotSpot(TM) 64-Bit Server VM (build 17.0-b16, mixed mode)
答案 0 :(得分:3)
这被添加到Parallel Scavenge收集器(-XX:+ UseParallelGC) 在jvm 6.0(野马)建立55.
(来自对https://community.oracle.com/thread/1543414?start=0&tstart=0的评论)
我正在使用“1.6.0_26”并且我确认我有相同的行为。 为了确认上一个声明,我尝试了串行垃圾收集器(-XX:+ UseSerialGC)并正确显示了终身年龄信息。
2014-02-14T16:04:03.285-0500: 686.879: [GC 686.880: [DefNew
Desired survivor size 13402112 bytes, new threshold 15 (max 15)
- age 1: 1288856 bytes, 1288856 total
- age 2: 320312 bytes, 1609168 total
- age 3: 9816 bytes, 1618984 total
- age 4: 33352 bytes, 1652336 total
- age 5: 6256 bytes, 1658592 total
- age 6: 34464 bytes, 1693056 total
- age 7: 9128 bytes, 1702184 total
- age 8: 100192 bytes, 1802376 total
- age 9: 9024 bytes, 1811400 total
- age 10: 55632 bytes, 1867032 total
- age 11: 14616 bytes, 1881648 total
- age 12: 302304 bytes, 2183952 total
- age 13: 682192 bytes, 2866144 total
- age 14: 11928 bytes, 2878072 total
- age 15: 13928 bytes, 2892000 total