-
Bug
-
Resolution: Not an Issue
-
P2
-
None
-
1.1.7
-
x86
-
windows_95
Name: clC74495 Date: 12/09/98
Carlos.Lucasius@Canada (December 9, 1998): This bug is from Hitachi,
a licensee. They claim that without solving this problem they won't be
able to ship their product, which is scheduled for the end of this month.
B.t.w., this bug seems to be strongly related to bugs 4193257, 4193258
(window objects not being garbage collected because of circular references),
which apparently still exist in JDK1.2 (or Java 2 now).
Please look into this issue as soon as possible.
ORIGINAL BUG REPORT FOLLOWS:
The class objects for the closed dialogs have been not deleted.
It causes insufficient memory.
( I don't set the following mark, because I don't know the meaning of the
number.
Priority:High.
Severity Impact: High.
Severity Functionality: High.
)
1. Steps to reproduce.
(1)Click the main window to display the child dialog.
(2)Repeat the same operation until display 5 or more child dialog.
(3)Close all child dialog.
(4)Check the remaining class object in the memory.
You will see 2 or 3 class object that had been used by the child
dialog.
<Problems>
Why are they remaining? Why are they not deleted completely, even
though the program is calling GC explicitly?
The remaining objects are preventing the repeat operation, and could
result in insufficient memory easily.
Please let me know the way to delete those object, if any.
Thanks!
2. Java Source code.
// main.java
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import ChildDialog.ChildDialog;
public class Main extends Frame implements ActionListener {
Button okButton = new Button("ok");
public Main() {
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
setVisible(false);
dispose();
System.exit(0);
}
});
setTitle("Main");
setSize(500, 400);
add(okButton);
pack();
okButton.addActionListener(this);
}
public static void main(String args[]) {
Main m = new Main();
m.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
if(e.getSource() == okButton) {
ChildDialog cd = new ChildDialog(new Frame());
cd.setVisible(true);
}
}
}
// ChildDialog.java
package ChildDialog;
import java.io.*;
import java.util.*;
import java.awt.*;
import java.awt.event.*;
public class ChildDialog extends Dialog {
public ChildDialog(Frame parent) {
super(parent, "ChildDialog", false);
setSize(125, 75);
addWindowListener(new WindowAdapter() {
public void windowClosing( WindowEvent e ) {
setVisible(false);
dispose();
java.lang.System.gc();
// java.lang.Runtime.gc();
}
});
}
}
(Review ID: 43471)
======================================================================
- relates to
-
JDK-4196661 JDialogs not being garbage collected
-
- Closed
-