8361827: [TESTBUG] serviceability/HeapDump/UnmountedVThreadNativeMethodAtTop.java throws OutOfMemoryError

Reviewed-by: clanger, syan
This commit is contained in:
Richard Reingruber 2025-07-16 06:12:07 +00:00
parent 6e368e0c69
commit cbb3d23e19

View File

@ -38,6 +38,7 @@ import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import com.sun.management.HotSpotDiagnosticMXBean;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
@ -49,6 +50,15 @@ public class UnmountedVThreadNativeMethodAtTop {
boolean done;
/**
* The tests accumulate previous heap dumps. Trigger GC before each test to get rid of them.
* This makes dumps smaller, processing faster, and avoids OOMs
*/
@BeforeEach
void doGC() {
System.gc();
}
/**
* Test dumping the heap while a virtual thread is blocked entering a synchronized native method.
*/