Commonly used in old gen GC. New gen uses ParNew

Heap size

  • normally 2-6 G, higher than that becomes much more debatable.
  • common to set min heap size same as max heap size to reduce OS scheduling cost

Goal: shortest stop the world time.

  • tag objects directed referenced by GC roots
  • Remark: fix changed introduced during the concurrent tag stage
  • By default GC thread 3 = (CPU + 3) /4
  • Still need to mark & sweep for old ge
  • Old gen will have frag problem that may trigger full gc too much
  • New gen GC strategy is same as ParNew
  1. STW, init mark: mark old gen objects DIRECTLY reachable from the GC root, and old gen objects referred by the new gen.
  2. Concurrent mark: use GC root tracing to tag all garbages, user thread still running
  3. Pre-sweep: tag old gen survival objects
  4. Interruptable pre-sweep
  5. STW: retag, scan GC roots + new gen + old gen objects with dirty cards
  6. concurrent sweep: mark unreachable object
  7. concrrent reset: reset gc state and enter the next GC cycle