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

Check for too small values for -Xmx

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
      gc
    • Resolved In Build:
      b115

      Description

      According to the documentation the VM requires that -Xmx (MaxHeapSize) is at least 2m:

      https://docs.oracle.com/javase/8/docs/technotes/tools/unix/java.html

      But there is no check in the VM to verify this. On the other hand we silently increase the size to 2m if anything less is specified:

      $ java -Xmx1m -XX:+PrintFlagsFinal -version | grep MaxHeapSize
          uintx MaxHeapSize := 2097152 {product}
      java version "1.9.0-ea"
      Java(TM) SE Runtime Environment (build 1.9.0-ea-b35)
      Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b35, mixed mode)

      If you happen to go below 1m we fail the minimum heap size test (-Xms):

      $ java -Xmx1023k -version
      Error occurred during initialization of VM
      Too small initial heap

      The reason the VM does not start with 1023K is actually not that we check the maximum heap size (Xmx) but that we check the initial heap size (Xms). Xms must be larger than 1m otherwise the VM does not start.

      It would be better to have an explicit check that -Xmx is > 2m and otherwise not start the VM.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                pliden Per Liden
                Reporter:
                brutisso Bengt Rutisson (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: