java默认垃圾收集器

 

jdk1.7 默认垃圾收集器Parallel Scavenge(新生代)+Parallel Old(老年代)

jdk1.8 默认垃圾收集器Parallel Scavenge(新生代)+Parallel Old(老年代)

jdk1.9 默认垃圾收集器G1

 

在程序启动里加jvm参数可打印相关信息:

-XX:+PrintCommandLineFlags 可查看默认设置收集器类型

-XX:+PrintGCDetails 可通过打印的GC日志的新生代、老年代名称判断


 

-XX:InitialHeapSize=132871552 -XX:MaxHeapSize=2125944832 
-XX:+PrintCommandLineFlags -XX:+PrintGCDetails 
-XX:+UseCompressedClassPointers -XX:+UseCompressedOops 
-XX:-UseLargePagesIndividualAllocation -XX:+UseParallelGC 




Heap
 PSYoungGen      total 38400K, used 3328K [0x00000000d5c00000, 0x00000000d8680000, 0x0000000100000000)
  eden space 33280K, 10% used [0x00000000d5c00000,0x00000000d5f40210,0x00000000d7c80000)
  from space 5120K, 0% used [0x00000000d8180000,0x00000000d8180000,0x00000000d8680000)
  to   space 5120K, 0% used [0x00000000d7c80000,0x00000000d7c80000,0x00000000d8180000)
 ParOldGen       total 87552K, used 0K [0x0000000081400000, 0x0000000086980000, 0x00000000d5c00000)
  object space 87552K, 0% used [0x0000000081400000,0x0000000081400000,0x0000000086980000)
 Metaspace       used 2853K, capacity 4486K, committed 4864K, reserved 1056768K
  class space    used 305K, capacity 386K, committed 512K, reserved 1048576K

 

你可能感兴趣的:(java默认垃圾收集器)