Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
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.*;

Expand All @@ -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();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Systen.gc() might not trigger full GC.

While not tjust o restrict heap for this test? 256M should be enough.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Systen.gc() might not trigger full GC.

Indeed. Might be better to use the Whitebox or start a dedicated VM.

While not tjust o restrict heap for this test? 256M should be enough.

This would not help. The tests accumulate heap dumps until OOM. See reproducer.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might not be the perfect solution but it surely reduces the noise in our testing.
So let's have this improvement in jdk25.
In jdk26 we can change the test to use WhiteBox::fullGC. What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've created a draft pr: #26363

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine.

}

/**
* Test dumping the heap while a virtual thread is blocked entering a synchronized native method.
*/
Expand Down