Merge
authorjiangli
Tue, 19 Jul 2016 20:07:06 +0200
changeset 39987 66623d85bbd8
parent 39986 416a95f29c6a (current diff)
parent 39981 eb1282859915 (diff)
child 39988 fc09d7800487
Merge
--- a/hotspot/test/gc/stress/TestStressG1Humongous.java	Tue Jul 19 13:52:14 2016 -0400
+++ b/hotspot/test/gc/stress/TestStressG1Humongous.java	Tue Jul 19 20:07:06 2016 +0200
@@ -26,9 +26,6 @@
  * @key gc
  * @key stress
  * @summary Stress G1 by humongous allocations in situation near OOM
- * Fails intermittently on 32-bit VMs due to 8160827 so quarantine
- * it on those platforms:
- * @requires vm.bits != "32"
  * @requires vm.gc.G1
  * @requires !vm.flightRecorder
  * @run main/othervm/timeout=200 -Xlog:gc=debug -Xmx1g -XX:+UseG1GC -XX:G1HeapRegionSize=4m
@@ -56,6 +53,7 @@
     private static final int THREAD_COUNT = Integer.getInteger("threads", 2);
     private static final int REGION_SIZE = Integer.getInteger("regionsize", 1) * 1024 * 1024;
     private static final int HUMONGOUS_SIZE = (int) (REGION_SIZE * Double.parseDouble(System.getProperty("humongoussize", "1.5")));
+    private static final int NUMBER_OF_FREE_REGIONS = 2;
 
     private volatile boolean isRunning;
     private final ExecutorService threadExecutor;
@@ -95,8 +93,12 @@
     private int getExpectedAmountOfObjects() {
         long maxMem = Runtime.getRuntime().maxMemory();
         int expectedHObjects = (int) (maxMem / HUMONGOUS_SIZE);
-        // Will allocate 1 region less to give some free space for VM.
-        int checkedAmountOfHObjects = checkHeapCapacity(expectedHObjects) - 1;
+        // Will allocate NUMBER_OF_FREE_REGIONS region less to give some free space for VM.
+        int checkedAmountOfHObjects = checkHeapCapacity(expectedHObjects) - NUMBER_OF_FREE_REGIONS;
+        if (checkedAmountOfHObjects <= 0) {
+            throw new RuntimeException("Cannot start testing because selected maximum heap "
+                    + "is not large enough to contain more than " + NUMBER_OF_FREE_REGIONS + " regions");
+        }
         return checkedAmountOfHObjects;
     }