--- old/test/gc/stress/TestStressG1Humongous.java 2016-07-19 17:20:33.124556828 +0300 +++ new/test/gc/stress/TestStressG1Humongous.java 2016-07-19 17:20:33.032555295 +0300 @@ -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 @@ -95,8 +92,11 @@ 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 2 region less to give some free space for VM. + int checkedAmountOfHObjects = checkHeapCapacity(expectedHObjects) - 2; + if (checkedAmountOfHObjects <= 0) { + throw new RuntimeException("Cannot start testing because there is no available memory."); + } return checkedAmountOfHObjects; }