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

Add -XX:MinHeapSize flag to set the minimum heap size

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Approved
    • Fix Version/s: 13
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
      gc
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      The intention is to keep the old behavior unless the new flag is used.
    • Interface Kind:
      add/remove/modify command line option

      Description

      Summary

      Add -XX:MinHeapSize flag to set the minimum heap size.

      Problem

      Currently the -Xms flag is documented to set the initial heap size, but it also sets the minimum heap size. The initial heap size can be overridden with the -XX:InitialHeapSize flag, but there is no such flag for the minimum heap size.

      To set the minimum heap size to a value different than the initial heap size the user must specify -Xms before -XX:InitialHeapSize.

      For example: -Xms4g -XX:InitialHeapSize=8g sets the minimum size to commit for the heap to 4g and the initially committed heap size to 8g.

      On the other hand, the following command line: -XX:InitialHeapSize=8g -Xms4g sets both the minimum and initial heap size to 4g.

      Solution

      I propose that we introduce a -XX:MinHeapSize flag to make it easier to independently set the minimum heap size and initial heap size.

      The user will get the expected behavior from either of the following command lines:

      • -XX:MinHeapSize=4g -XX:InitialHeapSize=8g
      • -XX:InitialHeapSize=8g -XX:MinHeapSize=4g

      The -Xms flag will keep it's old behavior and set both minimum and initial heap size, but when setting the minimum heap size it will change the MinHeapSize flag and not a JVM internal global variable. -Xms will behave as if both -XX:MinHeapSize and -XX:InitialHeapSize were set on the command line.

      The VM will enforce the relationship: MinHeapSize <= InitialHeapSize <= MaxHeapSize

      Specification

      First version of HotSpot implementation: http://cr.openjdk.java.net/~stefank/8223837/webrev.01/

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                stefank Stefan Karlsson
                Reporter:
                stefank Stefan Karlsson
                Reviewed By:
                Per Liden
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: