21 * questions.
22 */
23
24 import java.awt.AWTException;
25 import java.awt.FlowLayout;
26 import java.awt.Robot;
27 import java.lang.ref.Reference;
28 import java.lang.ref.WeakReference;
29 import java.util.ArrayList;
30 import java.util.List;
31 import java.util.logging.Level;
32 import java.util.logging.Logger;
33 import javax.swing.JButton;
34 import javax.swing.JFrame;
35 import javax.swing.JPanel;
36 import javax.swing.SwingUtilities;
37 import test.java.awt.regtesthelpers.Util;
38
39 /*
40 @test
41 @bug 7079254
42 @summary Toolkit eventListener leaks memory
43 @library ../regtesthelpers
44 @build Util
45 @compile LWDispatcherMemoryLeakTest.java
46 @run main/othervm -Xmx10M LWDispatcherMemoryLeakTest
47 */
48 public class LWDispatcherMemoryLeakTest {
49
50 private static JFrame frame;
51 private static WeakReference<JButton> button;
52 private static WeakReference<JPanel> p;
53
54 public static void init() throws Throwable {
55 SwingUtilities.invokeAndWait(new Runnable() {
56 @Override
57 public void run() {
58 frame = new JFrame();
59 frame.setLayout(new FlowLayout());
60 button = new WeakReference<JButton>(new JButton("Text"));
|
21 * questions.
22 */
23
24 import java.awt.AWTException;
25 import java.awt.FlowLayout;
26 import java.awt.Robot;
27 import java.lang.ref.Reference;
28 import java.lang.ref.WeakReference;
29 import java.util.ArrayList;
30 import java.util.List;
31 import java.util.logging.Level;
32 import java.util.logging.Logger;
33 import javax.swing.JButton;
34 import javax.swing.JFrame;
35 import javax.swing.JPanel;
36 import javax.swing.SwingUtilities;
37 import test.java.awt.regtesthelpers.Util;
38
39 /*
40 @test
41 @key headful
42 @bug 7079254
43 @summary Toolkit eventListener leaks memory
44 @library ../regtesthelpers
45 @build Util
46 @compile LWDispatcherMemoryLeakTest.java
47 @run main/othervm -Xmx10M LWDispatcherMemoryLeakTest
48 */
49 public class LWDispatcherMemoryLeakTest {
50
51 private static JFrame frame;
52 private static WeakReference<JButton> button;
53 private static WeakReference<JPanel> p;
54
55 public static void init() throws Throwable {
56 SwingUtilities.invokeAndWait(new Runnable() {
57 @Override
58 public void run() {
59 frame = new JFrame();
60 frame.setLayout(new FlowLayout());
61 button = new WeakReference<JButton>(new JButton("Text"));
|