Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8338440

Parallel: Improve fragmentation mitigation in Full GC

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 24
    • None
    • hotspot
    • gc
    • b13

      During a full GC with the Parallel collector, if the live objects in a region would cause an overflow in the target space, that region must be split, as described in `ParallelCompactData::summarize_split_space`.

      This split occurs at the end of a partial object, if present; otherwise, it occurs at the first live word. Consequently, when approaching the end of the target space, there can be unused memory (fragmentation) with a size of approximately one region, which is 64K words -- significantly larger than the average object size.

      A similar fragmentation issue exists for Serial and G1 full GC because objects cannot cross space or region boundaries. However, the issue is less severe, as the unused memory is approximately the size of an object.

      The effect of this fragmentation can be observed using `runtime/ClassInitErrors/TestOutOfMemoryDuringInit.java`. The Parallel collector takes significantly longer than other collectors, around 30 seconds compared to about 8 seconds. By adding `-Xlog:gc`, one can see that the Parallel collector runs approximately 47 full GCs, whereas others run around 12.

            ayang Albert Yang
            ayang Albert Yang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: