< prev index next >

test/gc/arguments/TestMaxHeapSizeTools.java

Print this page
rev 8935 : 8028254: gc/arguments/TestMinInitialErgonomics.java failed with unexpected initial heap size
Reviewed-by: brutisso, tschatzl, sjohanss

*** 39,50 **** final class MinInitialMaxValues { public long minHeapSize; public long initialHeapSize; public long maxHeapSize; ! public long minAlignment; ! public long maxAlignment; } class TestMaxHeapSizeTools { public static void checkMinInitialMaxHeapFlags(String gcflag) throws Exception { --- 39,50 ---- final class MinInitialMaxValues { public long minHeapSize; public long initialHeapSize; public long maxHeapSize; ! public long spaceAlignment; ! public long heapAlignment; } class TestMaxHeapSizeTools { public static void checkMinInitialMaxHeapFlags(String gcflag) throws Exception {
*** 190,200 **** // // where A, B, X, Y and Z are sizes in bytes. // Unfortunately there is no other way to retrieve the minimum heap size and // the alignments. ! Matcher m = Pattern.compile("Minimum heap \\d+ Initial heap \\d+ Maximum heap \\d+ Min alignment \\d+ Max alignment \\d+"). matcher(output.getStdout()); if (!m.find()) { throw new RuntimeException("Could not find heap size string."); } --- 190,200 ---- // // where A, B, X, Y and Z are sizes in bytes. // Unfortunately there is no other way to retrieve the minimum heap size and // the alignments. ! Matcher m = Pattern.compile("Minimum heap \\d+ Initial heap \\d+ Maximum heap \\d+ Space alignment \\d+ Heap alignment \\d+"). matcher(output.getStdout()); if (!m.find()) { throw new RuntimeException("Could not find heap size string."); }
*** 202,213 **** // actual values val.minHeapSize = valueAfter(match, "Minimum heap "); val.initialHeapSize = valueAfter(match, "Initial heap "); val.maxHeapSize = valueAfter(match, "Maximum heap "); ! val.minAlignment = valueAfter(match, "Min alignment "); ! val.maxAlignment = valueAfter(match, "Max alignment "); } /** * Verify whether the VM automatically synchronizes minimum and initial heap size if only * one is given for the GC specified. --- 202,213 ---- // actual values val.minHeapSize = valueAfter(match, "Minimum heap "); val.initialHeapSize = valueAfter(match, "Initial heap "); val.maxHeapSize = valueAfter(match, "Maximum heap "); ! val.spaceAlignment = valueAfter(match, "Space alignment "); ! val.heapAlignment = valueAfter(match, "Heap alignment "); } /** * Verify whether the VM automatically synchronizes minimum and initial heap size if only * one is given for the GC specified.
*** 216,231 **** long expectedMin, long expectedInitial) throws Exception { MinInitialMaxValues v = new MinInitialMaxValues(); getMinInitialMaxHeap(args, v); ! if ((expectedMin != -1) && (align_up(expectedMin, v.minAlignment) != v.minHeapSize)) { throw new RuntimeException("Actual minimum heap size of " + v.minHeapSize + " differs from expected minimum heap size of " + expectedMin); } ! if ((expectedInitial != -1) && (align_up(expectedInitial, v.minAlignment) != v.initialHeapSize)) { throw new RuntimeException("Actual initial heap size of " + v.initialHeapSize + " differs from expected initial heap size of " + expectedInitial); } // always check the invariant min <= initial <= max heap size --- 216,231 ---- long expectedMin, long expectedInitial) throws Exception { MinInitialMaxValues v = new MinInitialMaxValues(); getMinInitialMaxHeap(args, v); ! if ((expectedMin != -1) && (align_up(expectedMin, v.heapAlignment) != v.minHeapSize)) { throw new RuntimeException("Actual minimum heap size of " + v.minHeapSize + " differs from expected minimum heap size of " + expectedMin); } ! if ((expectedInitial != -1) && (align_up(expectedInitial, v.heapAlignment) != v.initialHeapSize)) { throw new RuntimeException("Actual initial heap size of " + v.initialHeapSize + " differs from expected initial heap size of " + expectedInitial); } // always check the invariant min <= initial <= max heap size
*** 245,255 **** final long K = 1024; MinInitialMaxValues v = new MinInitialMaxValues(); getMinInitialMaxHeap(new String[] { gcflag, "-XX:MaxHeapSize=" + maxHeapsize + "M" }, v); ! long expectedHeapSize = align_up(maxHeapsize * K * K, v.maxAlignment); long actualHeapSize = v.maxHeapSize; if (actualHeapSize > expectedHeapSize) { throw new RuntimeException("Heap has " + actualHeapSize + " bytes, expected to be less than " + expectedHeapSize); --- 245,255 ---- final long K = 1024; MinInitialMaxValues v = new MinInitialMaxValues(); getMinInitialMaxHeap(new String[] { gcflag, "-XX:MaxHeapSize=" + maxHeapsize + "M" }, v); ! long expectedHeapSize = align_up(maxHeapsize * K * K, v.heapAlignment); long actualHeapSize = v.maxHeapSize; if (actualHeapSize > expectedHeapSize) { throw new RuntimeException("Heap has " + actualHeapSize + " bytes, expected to be less than " + expectedHeapSize);
< prev index next >