8202878: com/apple/laf/ScreenMenu/ScreenMenuMemoryLeakTest.java fails
authorserb
Fri, 11 May 2018 15:27:51 -0700
changeset 50144 2a85d59e7f8b
parent 50143 8afb040fd242
child 50145 752645a158ff
8202878: com/apple/laf/ScreenMenu/ScreenMenuMemoryLeakTest.java fails Reviewed-by: prr
test/jdk/ProblemList.txt
test/jdk/com/apple/laf/ScreenMenu/ScreenMenuMemoryLeakTest.java
--- a/test/jdk/ProblemList.txt	Fri May 11 14:12:55 2018 -0700
+++ b/test/jdk/ProblemList.txt	Fri May 11 15:27:51 2018 -0700
@@ -751,7 +751,6 @@
 javax/swing/dnd/8139050/NativeErrorsInTableDnD.java 8202765  macosx-all,linux-all
 javax/swing/plaf/nimbus/8057791/bug8057791.java 8202877 macosx-all
 javax/swing/Popup/TaskbarPositionTest.java 8065097 macosx-all,linux-all
-com/apple/laf/ScreenMenu/ScreenMenuMemoryLeakTest.java 8202878 macosx-all
 java/awt/im/memoryleak/InputContextMemoryLeakTest.java 8023814 linux-all,solaris-all
 
 
--- a/test/jdk/com/apple/laf/ScreenMenu/ScreenMenuMemoryLeakTest.java	Fri May 11 14:12:55 2018 -0700
+++ b/test/jdk/com/apple/laf/ScreenMenu/ScreenMenuMemoryLeakTest.java	Fri May 11 15:27:51 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,9 +24,11 @@
 /**
  * @test
  * @key headful
- * @bug 8158325 8180821
+ * @bug 8158325 8180821 8202878
  * @summary Memory leak in com.apple.laf.ScreenMenu: removed JMenuItems are still referenced
  * @requires (os.family == "mac")
+ * @library /javax/swing/regtesthelpers
+ * @build Util
  * @run main/timeout=300/othervm -Xmx16m ScreenMenuMemoryLeakTest
  */
 
@@ -44,8 +46,6 @@
 
 public class ScreenMenuMemoryLeakTest {
 
-    private static byte[] sBytes;
-
     private static WeakReference<JMenuItem> sMenuItem;
     private static JFrame sFrame;
     private static JMenu sMenu;
@@ -65,9 +65,8 @@
                 removeMenuItemFromMenu();
             }
         });
-        System.gc();
-        System.runFinalization();
-        Thread.sleep(1000);
+
+        Util.generateOOME();
         JMenuItem menuItem = sMenuItem.get();
         EventQueue.invokeAndWait(new Runnable() {
             @Override