当我启动jvm
(jdk 8)时,我发现了此cms gc日志。它显示老一代使用0K(0K(1747648K)),但是jvm执行cms collect。为什么?
2019-01-31T18:00:28.603+0800: 4.466: [GC (CMS Initial Mark) [1 CMS-initial-mark: 0K(1747648K)] 65577K(2534080K), 0.0077440 secs] [Times: user=0.03 sys=0.00, real=0.01 secs]
2019-01-31T18:00:28.611+0800: 4.474: [CMS-concurrent-mark-start]
2019-01-31T18:00:28.627+0800: 4.490: [CMS-concurrent-mark: 0.016/0.016 secs] [Times: user=0.06 sys=0.01, real=0.02 secs]
2019-01-31T18:00:28.627+0800: 4.490: [CMS-concurrent-preclean-start]
2019-01-31T18:00:28.630+0800: 4.493: [CMS-concurrent-preclean: 0.003/0.003 secs] [Times: user=0.01 sys=0.00, real=0.00 secs]
2019-01-31T18:00:28.630+0800: 4.493: [CMS-concurrent-abortable-preclean-start]
2019-01-31T18:00:29.748+0800: 5.611: [CMS-concurrent-abortable-preclean: 0.824/1.117 secs] [Times: user=4.06 sys=0.13, real=1.12 secs]
2019-01-31T18:00:29.749+0800: 5.612: [GC (CMS Final Remark) [YG occupancy: 437791 K (786432 K)]2019-01-31T18:00:29.749+0800: 5.612: [Rescan (parallel) , 0.2379222 secs]2019-01-31T18:00:29.987+0800: 5.850: [weak refs processing, 0.0000407 secs]2019-01-31T18:00:29.987+0800: 5.850: [class unloading, 0.0058594 secs]2019-01-31T18:00:29.993+0800: 5.856: [scrub symbol table, 0.0026897 secs]2019-01-31T18:00:29.995+0800: 5.858: [scrub string table, 0.0006242 secs][1 CMS-remark: 0K(1747648K)] 437791K(2534080K), 0.2489874 secs] [Times: user=0.96 sys=0.02, real=0.25 secs]
以下是我的jvm选项:
-server -Xms2560m -Xmx2560m -XX:MaxPermSize=256m
-XX:+UnlockExperimentalVMOptions -Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=52001 -Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false -XX:+UseConcMarkSweepGC
-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=test
-XX:+PrintGCDateStamps -XX:+PrintGCDetails
-Xloggc:gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=10M
答案 0 :(得分:0)
它表明老一代使用0K(0K(1747648K))
这大概是由于启动堆占用率启发式方法将值定在非常低的值。尝试将其设置为显式设置-XX:InitiatingHeapOccupancyPercent=80 -XX+UseCMSInitiatingOccupancyOnly
,只有在80%的堆已满时才会启动一个。
答案 1 :(得分:0)
-XX:+ PrintTenuringDistribution和-XX:+ PrintGCCause是什么原因引起的?