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

UseCompressedOops should be set after limit_heap_by_allocatable_memory

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • P4
    • Resolution: Fixed
    • 19
    • 19
    • hotspot
    • gc
    • b19

    Description

      "ulimit -v" can limit the amount of virtual memory available to the JVM. Therefore, Arguments::set_heap_size() calls limit_heap_by_allocatable_memory() to reduce the max heap size to respect this limit.

      https://github.com/iklam/jdk/blame/a4d201909c8919b7465dee72594d718252c6344e/src/hotspot/share/runtime/arguments.cpp#L1755

      However, UseCompressedOops is set before limit_heap_by_allocatable_memory(). As a result, even if the final heap size is small enough, the JVM will still disable UseCompressedOops, and thus use more memory for oop pointers than necesary.

      In the following two test cases, the ergonomics code choose the same max heap size (5121245184), but UseCompressedOops is disabled in the second case.

      ~$ (ulimit -v 10000000; java -Xlog:gc*=debug -XX:MaxRAM=32g -version) 2>&1 | egrep '(Compressed Oops:)|(Maximum)'
      [0.023s][debug][gc,heap] Minimum heap 8388608 Initial heap 536870912 Maximum heap 5121245184
      [0.027s][info ][gc,init ] Compressed Oops: Enabled (Zero based)

      ~$ (ulimit -v 10000000; java -Xlog:gc*=debug -XX:MaxRAM=128g -version) 2>&1 | egrep '(Compressed Oops:)|(Maximum)'
      [0.021s][debug][gc,heap] Minimum heap 8388608 Initial heap 2147483648 Maximum heap 5121245184
      [0.028s][info ][gc,init ] Compressed Oops: Disabled

      Attachments

        Issue Links

          Activity

            People

              ayang Albert Yang
              iklam Ioi Lam
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: