我正在检查不同类型的 Java 垃圾收集器,我使用以下命令G1
在 Debian(挤压)系统上输出 GC 详细信息:
$ java -XX:+PrintCommandLineFlags -XX:+PrintGCDetails -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -version
-XX:MaxHeapSize=130024448 -XX:+PrintCommandLineFlags -XX:+PrintGCDetails
-XX:+UnlockExperimentalVMOptions -XX:+UseG1GC
java version "1.6.0_18"
OpenJDK Runtime Environment (IcedTea6 1.8.13) (6b18-1.8.13-0+squeeze2)
OpenJDK Client VM (build 14.0-b16, mixed mode)
Heap
F 0 space 1024K, 0% used [0xa8700000, 0xa8700000, 0xa8800000)
F 0 space 1024K, 0% used [0xa8800000, 0xa8800000, 0xa8900000)
F 0 space 1024K, 0% used [0xa8900000, 0xa8900000, 0xa8a00000)
F 0 space 1024K, 0% used [0xa8a00000, 0xa8a00000, 0xa8b00000)
F 0 space 1024K, 0% used [0xa8b00000, 0xa8b00000, 0xa8c00000)
F 0 space 1024K, 0% used [0xa8c00000, 0xa8c00000, 0xa8d00000)
F 0 space 1024K, 0% used [0xa8d00000, 0xa8d00000, 0xa8e00000)
Y 0 space 1024K, 17% used [0xa8e00000, 0xa8e2bc10, 0xa8f00000)
我可以在 G1 中看到堆布局是相同大小的块(区域),那么字符F
和Y
含义是什么,以及 17% 的使用是什么?
我还使用以下命令输出(我认为默认的)GC 详细信息:
$ java -XX:+PrintCommandLineFlags -XX:+PrintGCDetails -version
-XX:+PrintCommandLineFlags -XX:+PrintGCDetails
java version "1.6.0_18"
OpenJDK Runtime Environment (IcedTea6 1.8.13) (6b18-1.8.13-0+squeeze2)
OpenJDK Client VM (build 14.0-b16, mixed mode, sharing)
Heap
def new generation total 960K, used 180K [0x6f030000, 0x6f130000, 0x71790000)
eden space 896K, 20% used [0x6f030000, 0x6f05d010, 0x6f110000)
from space 64K, 0% used [0x6f110000, 0x6f110000, 0x6f120000)
to space 64K, 0% used [0x6f120000, 0x6f120000, 0x6f130000)
tenured generation total 4096K, used 0K [0x71790000, 0x71b90000, 0x8f030000)
the space 4096K, 0% used [0x71790000, 0x71790000, 0x71790200, 0x71b90000)
compacting perm gen total 12288K, used 24K [0x8f030000, 0x8fc30000, 0x93030000)
the space 12288K, 0% used [0x8f030000, 0x8f0361b8, 0x8f036200, 0x8fc30000)
ro space 8192K, 89% used [0x93030000, 0x93763300, 0x93763400, 0x93830000)
rw space 12288K, 59% used [0x93830000, 0x93f60560, 0x93f60600, 0x94430000)
我怎么知道这个默认的 GC 属于哪种类型的 GC?CMS 一台还是并行一台?