-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
5.0, 6
-
generic, x86
-
generic, windows_xp
FULL PRODUCT VERSION :
java version "1.5.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Windows XP
A DESCRIPTION OF THE PROBLEM :
Using JOptionPane.createDialog to construct a dialog for displaying results in the embedded component not being GC'ed when the dialog is dismissed. If you embed the same component within a JOptionPane.showMessageDialog you do not get a leak.
(Leak also exist in 1.4.2_02)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the following program and attach your favorite profiler to it. Count how many JLabels are left...
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Number of JLabels shoud be 0 (zero)
ACTUAL -
Number of JLabels was 10 (ten)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
public class Option
{
public static void main(String[] args) throws Throwable
{
// give yourself time to run profiler
System.out.println("attach profiler now...");
Thread.sleep(5000);
System.out.println("running app...");
// these JLabels don't get GC'ed :(
for(int i = 0; i < 10; i++)
{
JLabel goodbye = new JLabel("Goodbye " + i);
JOptionPane op = new JOptionPane(goodbye, JOptionPane.PLAIN_MESSAGE);
JDialog d = op.createDialog(null, "Goodbye");
d.setVisible(true);
op = null;
d = null;
goodbye = null;
}
// these JLabels GC correctly
for(int i = 0; i < 10; i++)
{
JLabel hello = new JLabel("Hello " + i);
JOptionPane.showMessageDialog(null, hello, "Hello", JOptionPane.PLAIN_MESSAGE);
}
}
}
---------- END SOURCE ----------
###@###.### 2005-2-25 08:49:08 GMT
java version "1.5.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Windows XP
A DESCRIPTION OF THE PROBLEM :
Using JOptionPane.createDialog to construct a dialog for displaying results in the embedded component not being GC'ed when the dialog is dismissed. If you embed the same component within a JOptionPane.showMessageDialog you do not get a leak.
(Leak also exist in 1.4.2_02)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the following program and attach your favorite profiler to it. Count how many JLabels are left...
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Number of JLabels shoud be 0 (zero)
ACTUAL -
Number of JLabels was 10 (ten)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
public class Option
{
public static void main(String[] args) throws Throwable
{
// give yourself time to run profiler
System.out.println("attach profiler now...");
Thread.sleep(5000);
System.out.println("running app...");
// these JLabels don't get GC'ed :(
for(int i = 0; i < 10; i++)
{
JLabel goodbye = new JLabel("Goodbye " + i);
JOptionPane op = new JOptionPane(goodbye, JOptionPane.PLAIN_MESSAGE);
JDialog d = op.createDialog(null, "Goodbye");
d.setVisible(true);
op = null;
d = null;
goodbye = null;
}
// these JLabels GC correctly
for(int i = 0; i < 10; i++)
{
JLabel hello = new JLabel("Hello " + i);
JOptionPane.showMessageDialog(null, hello, "Hello", JOptionPane.PLAIN_MESSAGE);
}
}
}
---------- END SOURCE ----------
###@###.### 2005-2-25 08:49:08 GMT
- relates to
-
JDK-4726458 Dialogs and Frames are never garbage collected
- Closed