8153277: [TESTBUG] gc/arguments/TestMaxMinHeapFreeRatioFlags is too sensitive for stray allocations in verifyRatio

Reviewed-by: mgerdin, dfazunen
This commit is contained in:
Aleksey Shipilev 2016-04-06 10:50:19 +03:00
parent 2f5768493d
commit b51a55a78c

View file

@ -168,6 +168,11 @@ public class TestMaxMinHeapFreeRatioFlags {
long maxHeapSize = getMax(); long maxHeapSize = getMax();
int gcTries = (shrinkHeapInSteps ? GC_TRIES : 1); int gcTries = (shrinkHeapInSteps ? GC_TRIES : 1);
// Initial checks. This also links up everything in these helper methods,
// in case it brings more garbage.
forceGC(gcTries);
verifyRatio(minRatio, maxRatio);
// commit 0.5 of total heap size to have enough space // commit 0.5 of total heap size to have enough space
// to both shink and expand // to both shink and expand
while (getCommitted() < maxHeapSize / 2) { while (getCommitted() < maxHeapSize / 2) {
@ -215,7 +220,6 @@ public class TestMaxMinHeapFreeRatioFlags {
if (previouslyCommitted <= getCommitted()) { if (previouslyCommitted <= getCommitted()) {
throw new RuntimeException("Heap was not shrinked."); throw new RuntimeException("Heap was not shrinked.");
} }
} }
public static void forceGC(int gcTries) { public static void forceGC(int gcTries) {