JEP draft JDK-8350152 (Automatic Heap Sizing for the Serial Garbage Collector) proposes dynamically sizing the young generation using GC overhead and adding support for committing and uncommitting memory depending on global memory pressure. The current implementation of the serial collector reserves a single block of memory for the entire heap then splits it into two ReservedSpaces, one for the young generation and another for the tenured generation. Each of the generations then individually commits and uncommits memory.
One drawback of this approach is that with dynamic sizing of the generations, fixed limits of the reserved spaces for each generation will not be compatible with the newly computed region sizes. A possible workaround is to reserve twice the maximum heap size to enable each generation to grow to the dynamically computed sizes. However, there would now be two memory regions to manage when committing and uncommitting memory. This issue proposes using a single reserved space and dynamically partitioning its committed memory into tenured and young regions for the automatic heap sizing scenario.
One drawback of this approach is that with dynamic sizing of the generations, fixed limits of the reserved spaces for each generation will not be compatible with the newly computed region sizes. A possible workaround is to reserve twice the maximum heap size to enable each generation to grow to the dynamically computed sizes. However, there would now be two memory regions to manage when committing and uncommitting memory. This issue proposes using a single reserved space and dynamically partitioning its committed memory into tenured and young regions for the automatic heap sizing scenario.