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

MemoryUsage getMax() reports -1 for sized G1 Eden & Survivor Spaces

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Not an Issue
    • Affects Version/s: 8u162
    • Fix Version/s: None
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
      gc

      Description


      We are using the G1 Garbage Collection (see [1] for options used). Using the JVM APIs, the following two memory pools for "max" (see [2]) return -1 (undefined).

      1. G1 Eden Space Type
      2. G1 Survivor Space

      Questions:

      1. Why does getMax() return the undefined value for G1 (see [2] below). We use this for CMS and do not have the same issue.
      2. Are there known defects in this area, if so, please provide the bugid(s)?
      3. Are there other options/workarounds for getting the "max" for the above two memory pools?

      We use ManagementFactory.getMemoryPoolMXBeans() [see [3]] to get the list of MemoryPoolMXBean pools, and for each MemoryPoolMXBean, we call getUsage() [see [4]) which returns a MemoryUsage object. The getMax() on this MemoryUsage it returns -1 for G1 Eden Space and G1 Survivor Space].

      [1] G1 options used
      -XX:+UseG1GC -XX:MaxGCPauseMillis=200

      [2] https://docs.oracle.com/javase/8/docs/api/java/lang/management/MemoryUsage.html

      public long getMax()
      Returns the maximum amount of memory in bytes that can be used for memory
      management. This method returns -1 if the maximum memory size is undefined.

      [3] https://docs.oracle.com/javase/8/docs/api/java/lang/management/ManagementFactory.html

      static List<MemoryPoolMXBean> getMemoryPoolMXBeans()
      Returns a list of MemoryPoolMXBean objects in the Java virtual machine.

      [4] https://docs.oracle.com/javase/8/docs/api/java/lang/management/MemoryPoolMXBean.html
      MemoryUsage getUsage()

        Attachments

          Activity

            People

            • Assignee:
              poonam Poonam Bajaj Parhar
              Reporter:
              shadowbug Shadow Bug
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: