8035939: java/lang/management/MemoryMXBean/MemoryManagement.java timed out on Linux-amd64
Reviewed-by: sla, brutisso, mgerdin
This commit is contained in:
parent
f0133ac1a0
commit
73e818fea9
jdk/test/java/lang/management/MemoryMXBean
@ -50,6 +50,7 @@ public class LowMemoryTest {
|
||||
private static boolean testFailed = false;
|
||||
private static final int NUM_TRIGGERS = 5;
|
||||
private static final int NUM_CHUNKS = 2;
|
||||
private static final int YOUNG_GEN_SIZE = 8 * 1024 * 1024;
|
||||
private static long chunkSize;
|
||||
|
||||
/**
|
||||
@ -59,11 +60,14 @@ public class LowMemoryTest {
|
||||
*/
|
||||
public static void main(String a[]) throws Throwable {
|
||||
final String main = "LowMemoryTest$TestMain";
|
||||
RunUtil.runTestKeepGcOpts(main);
|
||||
RunUtil.runTestClearGcOpts(main, "-XX:+UseSerialGC");
|
||||
RunUtil.runTestClearGcOpts(main, "-XX:+UseParallelGC");
|
||||
RunUtil.runTestClearGcOpts(main, "-XX:+UseG1GC");
|
||||
RunUtil.runTestClearGcOpts(main, "-XX:+UseConcMarkSweepGC");
|
||||
// Use a low young gen size to ensure that the
|
||||
// allocated objects are put in the old gen.
|
||||
final String nmFlag = "-Xmn" + YOUNG_GEN_SIZE;
|
||||
RunUtil.runTestKeepGcOpts(main, nmFlag);
|
||||
RunUtil.runTestClearGcOpts(main, nmFlag, "-XX:+UseSerialGC");
|
||||
RunUtil.runTestClearGcOpts(main, nmFlag, "-XX:+UseParallelGC");
|
||||
RunUtil.runTestClearGcOpts(main, nmFlag, "-XX:+UseG1GC");
|
||||
RunUtil.runTestClearGcOpts(main, nmFlag, "-XX:+UseConcMarkSweepGC");
|
||||
}
|
||||
|
||||
private static volatile boolean listenerInvoked = false;
|
||||
@ -156,6 +160,16 @@ public class LowMemoryTest {
|
||||
chunkSize = (mu.getMax() - mu.getUsed()) / 20;
|
||||
newThreshold = mu.getUsed() + (chunkSize * NUM_CHUNKS);
|
||||
|
||||
// Sanity check. Make sure the chunkSize is large than the YOUNG_GEN_SIZE
|
||||
// If the chunkSize are lower than the YOUNG_GEN_SIZE, we will get intermittent
|
||||
// failures when objects end up in the young gen instead of the old gen.
|
||||
// Tweak the test if this fails.
|
||||
if (chunkSize < YOUNG_GEN_SIZE) {
|
||||
throw new RuntimeException("TEST FAILED: " +
|
||||
" chunkSize: " + chunkSize + " is less than YOUNG_GEN_SIZE: " + YOUNG_GEN_SIZE +
|
||||
" max: " + mu.getMax() + " used: " + mu.getUsed() + " newThreshold: " + newThreshold);
|
||||
}
|
||||
|
||||
System.out.println("Setting threshold for " + mpool.getName() +
|
||||
" from " + mpool.getUsageThreshold() + " to " + newThreshold +
|
||||
". Current used = " + mu.getUsed());
|
||||
|
@ -31,7 +31,7 @@
|
||||
* @author Mandy Chung
|
||||
*
|
||||
* @build MemoryManagement MemoryUtil
|
||||
* @run main/othervm/timeout=600 MemoryManagement
|
||||
* @run main/othervm/timeout=600 -Xmn8m MemoryManagement
|
||||
*/
|
||||
|
||||
import java.lang.management.*;
|
||||
@ -49,6 +49,8 @@ public class MemoryManagement {
|
||||
private static volatile boolean trace = false;
|
||||
private static volatile boolean testFailed = false;
|
||||
private static final int NUM_CHUNKS = 2;
|
||||
// Must match -Xmn set on the @run line
|
||||
private static final int YOUNG_GEN_SIZE = 8 * 1024 * 1024;
|
||||
private static volatile long chunkSize;
|
||||
private static volatile int listenerInvoked = 0;
|
||||
|
||||
@ -112,6 +114,16 @@ public class MemoryManagement {
|
||||
}
|
||||
newThreshold = mu.getUsed() + (chunkSize * NUM_CHUNKS);
|
||||
|
||||
// Sanity check. Make sure the chunkSize is large than the YOUNG_GEN_SIZE
|
||||
// If the chunkSize are lower than the YOUNG_GEN_SIZE, we will get intermittent
|
||||
// failures when objects end up in the young gen instead of the old gen.
|
||||
// Tweak the test if this fails.
|
||||
if (chunkSize < YOUNG_GEN_SIZE) {
|
||||
throw new RuntimeException("TEST FAILED: " +
|
||||
" chunkSize: " + chunkSize + " is less than YOUNG_GEN_SIZE: " + YOUNG_GEN_SIZE +
|
||||
" max: " + mu.getMax() + " used: " + mu.getUsed() + " newThreshold: " + newThreshold);
|
||||
}
|
||||
|
||||
System.out.println("Setting threshold for " + mpool.getName() +
|
||||
" from " + mpool.getUsageThreshold() + " to " + newThreshold +
|
||||
". Current used = " + mu.getUsed());
|
||||
|
Loading…
x
Reference in New Issue
Block a user