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

Serial: Support allocation in old generation when heap is almost full

XMLWordPrintable

    • gc
    • b08

      In `SerialHeap::mem_allocate_work`, the decision to allocate in the young generation or old generation is based on the size of the allocation request. If the requested size is too small and the young generation is too full, a full GC is triggered. However, this approach can lead to inefficiencies. For example, if the first object in the young generation is too large to fit into the old generation, it can leave a significant gap at the end of the old generation, wasting space and increasing the frequency of full GCs.

      The attached benchmark from Tom Rodriguez demonstrates this issue. You can reproduce it using the following command:
      `java -Xmx100m -XX:+UseSerialGC -Xlog:gc StressAdd.java`

      When running this benchmark, one can observe over 1000 full GC pauses, highlighting the need for a more efficient allocation strategy.

      Prior to JDK-8333786, Serial contains a boolean flag to detect such scenarios (a non empty young-gen after full-gc) so that old-gen is also attempted even for small objects.

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

              Created:
              Updated:
              Resolved: