# HG changeset patch # User jwilhelm # Date 1439911930 -7200 # Node ID 39bed844f69e793a9b359597d1000b7ebe23776b # Parent a4312636c0f70a04d536788bdd39006340fef9c2 8130308: Too low memory usage in TestPromotionFromSurvivorToTenuredAfterMinorGC.java Reviewed-by: dfazunen, brutisso diff -r a4312636c0f7 -r 39bed844f69e test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java --- a/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java Tue Feb 02 19:20:19 2021 +0000 +++ b/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java Tue Aug 18 17:32:10 2015 +0200 @@ -96,11 +96,18 @@ .getActualMemoryUsage(); test.allocate(); - for (int i = 0; i <= SurvivorAlignmentTestMain.MAX_TENURING_THRESHOLD; - i++) { + for (int i = 0; i <= SurvivorAlignmentTestMain.MAX_TENURING_THRESHOLD; i++) { SurvivorAlignmentTestMain.WHITE_BOX.youngGC(); } + // Sometimes we see that data unrelated to the test has been allocated during + // the loop. This data is included in the expectedMemoryUsage since we look + // through all threads to see what they allocated. If this data is still in + // the survivor area however, it should not be included in expectedMemoryUsage + // since the verification below only look at what's in tenured space. + expectedMemoryUsage -= SurvivorAlignmentTestMain.getAlignmentHelper( + SurvivorAlignmentTestMain.HeapSpace.SURVIVOR) + .getActualMemoryUsage(); test.verifyMemoryUsage(expectedMemoryUsage); } }