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

java/lang/management/MemoryMXBean/MemoryManagement is not robust when getMax() returns -1

XMLWordPrintable

        The test MemoryManagement times out when the G1 GC is used. The culprit is the following line:

          chunkSize = (mu.getMax() - mu.getUsed()) / 20;

        G1's pools return -1 for their max size (which according to the spec means undefined). However, the test does not check for that which causes chunkSize to be calculated as 0. This results in the thread that's supposed to do a lot of allocations to get into an infinite loop (hence the time-out).

        To be extra sure the problem is as described above, I hard-coded chunkSize to be 1M and the rest run successfully.

              sjiang Shanliang Jiang (Inactive)
              tonyp Tony Printezis
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: