您好老师;
我的jdk版本是1.8
JVM配置是:
-Xms20m -Xmx20m -Xmn10m -XX:SurvivorRatio=8 -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+UseConcMarkSweepGC
完整代码是:
public class CmGC {
private static int size = 1024 * 4096;
public static void main(String[] args) {
System.out.println("step 1...");
byte[] allo = new byte[size];
System.out.println("step 2...");
byte[] allo2 = new byte[size];
System.out.println("step 3...");
byte[] allo3 = new byte[size / 2];
System.out.println("step 4...");
byte[] allo4 = new byte[size];
System.out.println("step 5...");
}
}
完整日志是:
step 1...
step 2...
0.090: [GC (Allocation Failure) 0.090: [ParNew: 6121K->670K(9216K), 0.0018622 secs] 6121K->4768K(19456K), 0.0019040 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
step 3...
step 4...
0.092: [GC (Allocation Failure) 0.092: [ParNew (promotion failed): 7053K->6530K(9216K), 0.0025480 secs]0.095: [CMS: 8704K->8680K(10240K), 0.0028019 secs] 11151K->10852K(19456K), [Metaspace: 3270K->3270K(1056768K)], 0.0053938 secs] [Times: user=0.00 sys=0.00, real=0.01 secs]
0.098: [GC (CMS Initial Mark) [1 CMS-initial-mark: 8680K(10240K)] 14948K(19456K), 0.0004626 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
0.099: [CMS-concurrent-mark-start]
step 5...
Heap
par new generation total 9216K, used 6725K [0x00000000fec00000, 0x00000000ff600000, 0x00000000ff600000)
eden space 8192K, 82% used [0x00000000fec00000, 0x00000000ff291548, 0x00000000ff400000)
from space 1024K, 0% used [0x00000000ff400000, 0x00000000ff400000, 0x00000000ff500000)
to space 1024K, 0% used [0x00000000ff500000, 0x00000000ff500000, 0x00000000ff600000)
concurrent mark-sweep generation total 10240K, used 8680K [0x00000000ff600000, 0x0000000100000000, 0x0000000100000000)
Metaspace used 3294K, capacity 4496K, committed 4864K, reserved 1056768K
class space used 357K, capacity 388K, committed 512K, reserved 1048576K
Process finished with exit code 0
请问:为什么看不到CMS 后面几个阶段? 如:预清理、重新标记,并发清理等几个阶段?