2 Replies Latest reply: Jun 22, 2012 4:51 AM by 944262 RSS

    Which is the default behavior of G1GC in Java7 update 4 or later?

    944262
      In the [Java HotSpot VM Options|http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html],
      it seems G1GC is default enable in Java7 update 4 or later (because G1GC is formally supported at Java 7 update4).

      But I tried to run this code with -server JVM option on Java 7 update 5 on Ubuntu 64bit Server Edition.

      for (GarbageCollectorMXBean bean : ManagementFactory.getGarbageCollectorMXBeans()) {
      System.out.println(bean.getName());
      }

      The result is below.
      PS Scavenge
      PS MarkSweep

      And I run the same code with -server -XX:+UseG1GC JVM option on Java 7 update 5, the result is
      G1 Young Generation
      G1 Old Generation

      This result shows G1GC is NOT default in Java 7 update 5.
      Is this a bug of JVM? Or a bug of document page?

      Edited by: tanaka733 on 2012/06/18 1:49