< prev index next >

test/jdk/java/lang/management/MemoryMXBean/CollectionUsageThreshold.java

Print this page

        

@@ -73,11 +73,12 @@
     public static void main(String a[]) throws Throwable {
         final String main = "CollectionUsageThreshold$TestMain";
         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");
         }
     }
 

@@ -145,15 +146,21 @@
             }
 
             // 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) {
                         break;
                     }
< prev index next >