Skip to content

Commit e599ee4

Browse files
author
SendaoYan
committed
8361827: [TESTBUG] serviceability/HeapDump/UnmountedVThreadNativeMethodAtTop.java throws OutOfMemoryError
Reviewed-by: rrich, lmesnik Backport-of: cbb3d23
1 parent 3a8e9df commit e599ee4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/hotspot/jtreg/serviceability/HeapDump/UnmountedVThreadNativeMethodAtTop.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import java.util.concurrent.CountDownLatch;
3939
import com.sun.management.HotSpotDiagnosticMXBean;
4040

41+
import org.junit.jupiter.api.BeforeEach;
4142
import org.junit.jupiter.api.Test;
4243
import static org.junit.jupiter.api.Assertions.*;
4344

@@ -49,6 +50,15 @@ public class UnmountedVThreadNativeMethodAtTop {
4950

5051
boolean done;
5152

53+
/**
54+
* The tests accumulate previous heap dumps. Trigger GC before each test to get rid of them.
55+
* This makes dumps smaller, processing faster, and avoids OOMs
56+
*/
57+
@BeforeEach
58+
void doGC() {
59+
System.gc();
60+
}
61+
5262
/**
5363
* Test dumping the heap while a virtual thread is blocked entering a synchronized native method.
5464
*/

0 commit comments

Comments
 (0)