Skip to content

Commit b209412

Browse files
committed
backport 85fc47c81af81a595dc88e61454d8ba2d860f301
1 parent 0b3561a commit b209412

File tree

1 file changed

+1
-29
lines changed

1 file changed

+1
-29
lines changed

test/jdk/java/io/ObjectStreamClass/ObjectStreamClassCaching.java

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -69,41 +69,13 @@
6969
/*
7070
* @test id=Serial
7171
* @requires vm.gc.Serial
72-
* @bug 8277072
72+
* @bug 8277072 8327180
7373
* @library /test/lib/
7474
* @summary ObjectStreamClass caches keep ClassLoaders alive (Serial GC)
7575
* @run testng/othervm -Xmx64m -XX:+UseSerialGC ObjectStreamClassCaching
7676
*/
7777
public class ObjectStreamClassCaching {
7878

79-
/**
80-
* Test methods execute in same VM and are ordered by name.
81-
* We test effectiveness 1st which is sensitive to previous allocations when ZGC is used.
82-
*/
83-
@Test
84-
public void test1CacheEffectiveness() throws Exception {
85-
var list = new ArrayList<>();
86-
var ref1 = lookupObjectStreamClass(TestClass1.class);
87-
var ref2 = newWeakRef();
88-
boolean oome = false;
89-
try {
90-
while (!ref2.refersTo(null)) {
91-
list.add(new byte[1024 * 1024 * 1]); // 1 MiB chunks
92-
System.out.println("1MiB allocated...");
93-
Thread.sleep(5L);
94-
}
95-
} catch (OutOfMemoryError e) {
96-
// release
97-
list = null;
98-
oome = true;
99-
}
100-
assertFalse(oome, "WeakReference was not cleared although memory was pressed hard");
101-
assertFalse(ref1.refersTo(null),
102-
"Cache lost entry together with WeakReference being cleared although memory was not under pressure");
103-
System.gc();
104-
Thread.sleep(100L);
105-
}
106-
10779
@Test
10880
public void test2CacheReleaseUnderMemoryPressure() throws Exception {
10981
var list = new ArrayList<>();

0 commit comments

Comments
 (0)