make AwtListGarbageCollectionTest pass reliably

(cherry picked from commit 304eb7f919)
This commit is contained in:
Dmitry Batrak
2021-02-08 12:21:58 +03:00
committed by alexey.ushakov@jetbrains.com
parent 3b6464043b
commit 133904610f

View File

@@ -30,9 +30,8 @@
*/
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.lang.ref.WeakReference;
import java.util.concurrent.locks.LockSupport;
public class AwtListGarbageCollectionTest {
public static void main(String[] args) {
@@ -57,6 +56,8 @@ public class AwtListGarbageCollectionTest {
weakListRef = new WeakReference<List>(strongListRef);
strongListRef = null;
LockSupport.parkNanos(1_000_000_000);
//make out of memory to force gc
String veryLongString = new String(new char[100]);
while (true) {