关于G1的Java 7(JDK 7)垃圾收集和文档Java 7已经出现了一段时间了,但我找不到任何关于垃圾收集器配置的好资源,特别是新的G1收集器。我的问题:G1是Java 7中的默认收集器,如果不是,我如何激活G1?g7在Java7中有哪些可选设置?是否对Java 7中的其他收集器(如cms或并行收集器)进行了更改?在哪里可以找到有关Java 7中垃圾收集的好文档?
3 回答
白衣非少年
TA贡献1155条经验 获得超0个赞
G1垃圾收集器不是我安装的Java版本1.7.0_01中的默认值。您可以通过使用一些额外的命令行选项来自己查看:
> java -XX:+PrintCommandLineFlags -XX:+PrintGCDetails -version-XX:InitialHeapSize=132304640 -XX:MaxHeapSize=2116874240 -XX:ParallelGCThreads=4 -XX:+PrintCommandLineFlags -XX:+PrintGCDetails -XX:+UseCompressedOops -XX:-UseLargePagesIndividualAllocation -XX:+UseParallelGCjava version "1.7.0_01"Java(TM) SE Runtime Environment (build 1.7.0_01-b08)Java HotSpot(TM) 64-Bit Server VM (build 21.1-b02, mixed mode)Heap PSYoungGen total 37696K, used 1293K [0x00000007d5eb0000, 0x00000007d88c0000, 0x0000000800000000) eden space 32320K, 4% used [0x00000007d5eb0000,0x00000007d5ff3408,0x00000007d7e40000) from space 5376K, 0% used [0x00000007d8380000,0x00000007d8380000,0x00000007d88c0000) to space 5376K, 0% used [0x00000007d7e40000,0x00000007d7e40000,0x00000007d8380000) PSOldGen total 86144K, used 0K [0x0000000781c00000, 0x0000000787020000, 0x00000007d5eb0000) object space 86144K, 0% used [0x0000000781c00000,0x0000000781c00000,0x0000000787020000) PSPermGen total 21248K, used 2032K [0x000000077ca00000, 0x000000077dec0000, 0x0000000781c00000) object space 21248K, 9% used [0x000000077ca00000,0x000000077cbfc288,0x000000077dec0000)
您不需要启用实验选项来打开G1收集器,但是:
> java -XX:+PrintCommandLineFlags -XX:+PrintGCDetails -XX:+UseG1GC -version-XX:InitialHeapSize=132304640 -XX:MaxHeapSize=2116874240 -XX:+PrintCommandLineFlags -XX:+PrintGCDetails -XX:+UseCompressedOops -XX:+UseG1GC -XX:-UseLargePagesIndividualAllocationjava version "1.7.0_01"Java(TM) SE Runtime Environment (build 1.7.0_01-b08)Java HotSpot(TM) 64-Bit Server VM (build 21.1-b02, mixed mode)Heap garbage-first heap total 130048K, used 0K [0x000000077ca00000, 0x0000000784900000, 0x00000007fae00000) region size 1024K, 1 young (1024K), 0 survivors (0K) compacting perm gen total 20480K, used 2032K [0x00000007fae00000, 0x00000007fc200000, 0x0000000800000000) the space 20480K, 9% used [0x00000007fae00000, 0x00000007faffc288, 0x00000007faffc400, 0x00000007fc200000)No shared spaces configured.
我不知道在哪里可以找到任何好的文档。
添加回答
举报
0/150
提交
取消