8304436: com/sun/jdi/ThreadMemoryLeakTest.java fails with "OutOfMemoryError: Java heap space" with ZGC

8304449: com/sun/jdi/ThreadMemoryLeakTest.java times out

Reviewed-by: lmesnik, dcubed
This commit is contained in:
Chris Plummer 2023-03-29 23:29:30 +00:00
parent 69152c3b18
commit 9643f654da
2 changed files with 10 additions and 19 deletions

View File

@ -28,5 +28,3 @@
#############################################################################
java/util/concurrent/locks/Lock/OOMEInAQS.java 8298066 windows-x64
com/sun/jdi/ThreadMemoryLeakTest.java 8304436 generic-all

View File

@ -30,8 +30,8 @@
* @requires (vm.compMode == "Xmixed")
* @run build TestScaffold VMConnection TargetListener TargetAdapter
* @run compile -g ThreadMemoryLeakTest.java
* @comment run with -Xmx6m so any leak will quickly produce OOME
* @run main/othervm -Xmx6m ThreadMemoryLeakTest
* @comment run with -Xmx7m so any leak will quickly produce OOME
* @run main/othervm -Xmx7m ThreadMemoryLeakTest
*/
import com.sun.jdi.*;
import com.sun.jdi.event.*;
@ -95,30 +95,23 @@ public class ThreadMemoryLeakTest extends TestScaffold {
/********** event handlers **********/
static int threadStartCount;
static int threadDeathCount;
private static List<ThreadReference> threads =
Collections.synchronizedList(new ArrayList<ThreadReference>());
static LongAdder threadStartCount = new LongAdder();
static LongAdder threadDeathCount = new LongAdder();
public void threadStarted(ThreadStartEvent event) {
threadStartCount++;
if ((threadStartCount % 1000) == 0) {
threadStartCount.increment();
if ((threadStartCount.sum() % 1000) == 0) {
println("Got ThreadStartEvent #" + threadStartCount +
" threads:" + threads.size());
" threads:" + (threadStartCount.sum() - threadDeathCount.sum()));
}
ThreadStartEvent tse = (ThreadStartEvent)event;
threads.add(tse.thread());
}
public void threadDied(ThreadDeathEvent event) {
threadDeathCount++;
if ((threadDeathCount % 1000) == 0) {
threadDeathCount.increment();
if ((threadDeathCount.sum() % 1000) == 0) {
println("Got ThreadDeathEvent #" + threadDeathCount +
" threads:" + threads.size());
" threads:" + (threadStartCount.sum() - threadDeathCount.sum()));
}
ThreadDeathEvent tde = (ThreadDeathEvent)event;
ThreadReference thread = tde.thread();
threads.remove(thread);
}
public void vmDied(VMDeathEvent event) {