Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions test/jdk/java/lang/management/MemoryMXBean/LowMemoryTest2.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -35,25 +35,23 @@
* @test
* @bug 4982128
* @summary Test low memory detection of non-heap memory pool
*
* @run main/othervm/timeout=600 -Xnoclassgc -XX:MaxMetaspaceSize=32m
* LowMemoryTest2
*/

/*
* @test
* @bug 4982128
* @summary Test low memory detection of non-heap memory pool
*
* @run main/othervm/timeout=600 -Xnoclassgc -XX:MaxMetaspaceSize=16m
* -XX:CompressedClassSpaceSize=4m LowMemoryTest2
* @library /test/lib
* @build jdk.test.whitebox.WhiteBox
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm/timeout=600 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
* -Xnoclassgc -XX:MaxMetaspaceSize=32m LowMemoryTest2
* @run main/othervm/timeout=600 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
* -Xnoclassgc -XX:MaxMetaspaceSize=16m
* -XX:CompressedClassSpaceSize=4m LowMemoryTest2
*/

import java.lang.management.*;
import javax.management.*;
import javax.management.openmbean.CompositeData;
import java.util.*;

import jdk.test.whitebox.WhiteBox;

public class LowMemoryTest2 {

private static volatile boolean listenerInvoked = false;
Expand Down Expand Up @@ -177,7 +175,7 @@ public void run() {
// If we don't force a GC we may get an
// OutOfMemoryException before the counters are updated.
System.out.println("Force GC");
System.gc();
WhiteBox.getWhiteBox().fullGC();
}
isThresholdCountSet = isAnyThresholdCountSet(pools);
}
Expand Down