Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4171853

The memory size of the jre process increases without any limitation.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P1
    • None
    • 1.1.6
    • client-libs
    • sparc
    • solaris_2.5.1

    Description

      (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] Although the Panel.removeAll() method is called in cycle,
               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 Panel panel1;
      public NewFrame newframe=null;

      public ShowFrame(){
      setSize(500,300);
      setLayout(null);

      panel1 = new Panel();
      panel1.setSize(500,200);
      panel1.setLayout(null);
      panel1.setLocation(0,0);
      panel1.setBackground(Color.yellow);
      add(panel1);

      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 Execute");
      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();
      panel1.add(newframe);
      }
      if(e.getSource() == button2){
      if(newframe == null){
      return;
      }
      panel1.removeAll();
      newframe=null;
      panel1.validate();
      }
      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 Panel{
      private Button b;
      private TextField t;
      public NewFrame(){
      setSize(300,100);
      setLocation(20,20);
      setBackground(Color.red);
      setLayout(null);

      b = new Button("ɽ¼¨");
      b.setSize(100,40);
      b.setLocation(10,10);
      add(b);

      t = new TextField("¥Æ¥­¥¹¥È¥Õ¥£¡¼¥ë¥É");
      t.setSize(100,40);
      t.setLocation(110,10);
      add(t);
      }
      }

      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();
      this.sf.panel1.add(this.sf.newframe);
      }
      else{
      if(this.sf.newframe == null){
      continue;
      }
      this.sf.panel1.removeAll();
      this.sf.newframe=null;
      this.sf.panel1.validate();
      }
      }
      catch(Exception e){
      System.out.println(e);
      System.exit(1);
      }
      if(i % 200 == 0){
      System.out.println(Integer.toString(i+1));
      }
      }
      }
      }

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              duke J. Duke
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: