-
Bug
-
Resolution: Fixed
-
P4
-
1.1.6, 1.1.7
-
b03
-
sparc
-
solaris_2.5.1
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2022707 | 1.2.2 | Mingyao Yang | P4 | Resolved | Fixed | 1.2.2 |
JDK-2022706 | 1.2.1_002 | Mingyao Yang | P4 | Resolved | Fixed | b02 |
JDK-2022705 | 1.1.8 | Mingyao Yang | P4 | Resolved | Fixed | 1.1.8 |
JDK-2022704 | 1.1.7 | Mingyao Yang | P4 | Resolved | Fixed | b01 |
(1) Working environments
OS : Solaris2.5.1 Japanese version
JRE : JRE1.1.6
Window : CDE
A Java source named ShowFrame.java is attached for reproducing the phenomenon.
(2) Phenomenon
The memory size of the jre process increases without any limitation.
[Step 1] Runn ShowFrame.class.
" jre ShowFrame"
[Step 2] Push [Auto Excute] button
[Step 3] Even there is a dipose method being called,
the memory is not freed.
And so the memory size of the jre process grows
without any limitation.
The memory size can be checked by command below.
ps -u usrname -o pmem,fname | grep jre
-------- ShowFrame.java ---------
import java.awt.*;
import java.awt.event.*;
public class ShowFrame extends Frame implements ActionListener{
public Button button1;
public Button button2;
public Button button3;
public Button button4;
public NewFrame newframe=null;
public ShowFrame(){
setSize(500,300);
setLayout(null);
button1 = new Button("Display");
button1.setSize(100,40);
button1.setLocation(10,200);
button1.addActionListener(this);
add(button1);
button2 = new Button("Erase");
button2.setSize(100,40);
button2.setLocation(120,200);
button2.addActionListener(this);
add(button2);
button3 = new Button("Auto Excute");
button3.setSize(100,40);
button3.setLocation(230,200);
button3.addActionListener(this);
add(button3);
button4 = new Button("End");
button4.setSize(100,40);
button4.setLocation(340,200);
button4.addActionListener(this);
add(button4);
setVisible(true);
}
public void actionPerformed(ActionEvent e){
if(e.getSource() == button1){
if(newframe != null){
return;
}
newframe = new NewFrame();
}
if(e.getSource() == button2){
if(newframe == null){
return;
}
newframe.dispose();
newframe=null;
}
if(e.getSource() == button3){
new AutoExec(this);
}
if(e.getSource() == button4){
System.exit(0);
}
}
static public void main(String str[]){
new ShowFrame();
}
}
class NewFrame extends Frame{
public NewFrame(){
setSize(100,100);
setBackground(Color.red);
setLayout(null);
setVisible(true);
}
}
class AutoExec extends Thread{
private ShowFrame sf;
public AutoExec(ShowFrame sf){
this.sf = sf;
this.start();
}
public void run(){
for(int i = 0;i < 2002;i++){
try{
sleep(1000);
if(i % 2 == 0){
if(this.sf.newframe != null){
continue;
}
this.sf.newframe = new NewFrame();
}
else{
if(this.sf.newframe == null){
continue;
}
this.sf.newframe.dispose();
this.sf.newframe=null;
}
}
catch(Exception e){
System.out.println(e);
System.exit(1);
}
if(i % 200 == 0){
System.out.println(Integer.toString(i+1));
}
}
}
}
OS : Solaris2.5.1 Japanese version
JRE : JRE1.1.6
Window : CDE
A Java source named ShowFrame.java is attached for reproducing the phenomenon.
(2) Phenomenon
The memory size of the jre process increases without any limitation.
[Step 1] Runn ShowFrame.class.
" jre ShowFrame"
[Step 2] Push [Auto Excute] button
[Step 3] Even there is a dipose method being called,
the memory is not freed.
And so the memory size of the jre process grows
without any limitation.
The memory size can be checked by command below.
ps -u usrname -o pmem,fname | grep jre
-------- ShowFrame.java ---------
import java.awt.*;
import java.awt.event.*;
public class ShowFrame extends Frame implements ActionListener{
public Button button1;
public Button button2;
public Button button3;
public Button button4;
public NewFrame newframe=null;
public ShowFrame(){
setSize(500,300);
setLayout(null);
button1 = new Button("Display");
button1.setSize(100,40);
button1.setLocation(10,200);
button1.addActionListener(this);
add(button1);
button2 = new Button("Erase");
button2.setSize(100,40);
button2.setLocation(120,200);
button2.addActionListener(this);
add(button2);
button3 = new Button("Auto Excute");
button3.setSize(100,40);
button3.setLocation(230,200);
button3.addActionListener(this);
add(button3);
button4 = new Button("End");
button4.setSize(100,40);
button4.setLocation(340,200);
button4.addActionListener(this);
add(button4);
setVisible(true);
}
public void actionPerformed(ActionEvent e){
if(e.getSource() == button1){
if(newframe != null){
return;
}
newframe = new NewFrame();
}
if(e.getSource() == button2){
if(newframe == null){
return;
}
newframe.dispose();
newframe=null;
}
if(e.getSource() == button3){
new AutoExec(this);
}
if(e.getSource() == button4){
System.exit(0);
}
}
static public void main(String str[]){
new ShowFrame();
}
}
class NewFrame extends Frame{
public NewFrame(){
setSize(100,100);
setBackground(Color.red);
setLayout(null);
setVisible(true);
}
}
class AutoExec extends Thread{
private ShowFrame sf;
public AutoExec(ShowFrame sf){
this.sf = sf;
this.start();
}
public void run(){
for(int i = 0;i < 2002;i++){
try{
sleep(1000);
if(i % 2 == 0){
if(this.sf.newframe != null){
continue;
}
this.sf.newframe = new NewFrame();
}
else{
if(this.sf.newframe == null){
continue;
}
this.sf.newframe.dispose();
this.sf.newframe=null;
}
}
catch(Exception e){
System.out.println(e);
System.exit(1);
}
if(i % 200 == 0){
System.out.println(Integer.toString(i+1));
}
}
}
}
- backported by
-
JDK-2022704 Memory leaks in AWT when interacting with MOTIF
- Resolved
-
JDK-2022705 Memory leaks in AWT when interacting with MOTIF
- Resolved
-
JDK-2022706 Memory leaks in AWT when interacting with MOTIF
- Resolved
-
JDK-2022707 Memory leaks in AWT when interacting with MOTIF
- Resolved
- duplicates
-
JDK-4171853 The memory size of the jre process increases without any limitation.
- Closed
-
JDK-4233925 TextField.GetText() crashes
- Closed
(1 duplicates)