--- old/test/jdk/java/lang/management/MemoryMXBean/CollectionUsageThreshold.java 2018-10-19 10:54:17.000000000 -0400 +++ new/test/jdk/java/lang/management/MemoryMXBean/CollectionUsageThreshold.java 2018-10-19 10:54:17.000000000 -0400 @@ -75,7 +75,8 @@ RunUtil.runTestKeepGcOpts(main); RunUtil.runTestClearGcOpts(main, "-XX:+UseSerialGC"); RunUtil.runTestClearGcOpts(main, "-XX:+UseParallelGC"); - RunUtil.runTestClearGcOpts(main, "-XX:+UseG1GC"); + RunUtil.runTestClearGcOpts(main, "-XX:+UseG1GC", "-XX:-G1UseLegacyMonitoring"); + RunUtil.runTestClearGcOpts(main, "-XX:+UseG1GC", "-XX:+G1UseLegacyMonitoring"); if (!Compiler.isGraalEnabled()) { // Graal does not support CMS RunUtil.runTestClearGcOpts(main, "-XX:+UseConcMarkSweepGC"); } @@ -147,11 +148,17 @@ // Find the Old generation which supports low memory detection for (MemoryPoolMXBean p : pools) { if (p.isUsageThresholdSupported() && p.isCollectionUsageThresholdSupported()) { - if (p.getName().toLowerCase().contains("perm")) { + String poolName = p.getName().toLowerCase(); + if (poolName.contains("perm")) { // if we have a "perm gen" pool increase the number of expected // memory pools by one. numMemoryPools++; } + if (poolName.contains("g1 humongous space")) { + // if we have a "g1 humongous space" pool increase the number of expected + // memory pools by one. + numMemoryPools++; + } PoolRecord pr = new PoolRecord(p); result.put(p.getName(), pr); if (result.size() == numMemoryPools) {