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

Applets Do Not Release ALL/NO Memory When Destroyed in IE.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P3 P3
    • 7u6
    • 6u4
    • deploy
    • x86
    • windows_2003

      FULL PRODUCT VERSION :
      java version "1.6.0_04"
      Java(TM) SE Runtime Environment (build 1.6.0_04-b12)
      Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows Server 2003, Standard edition

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Internet Explorer 6

      A DESCRIPTION OF THE PROBLEM :
      When an applet is launced in IE6 then if the user hist refresh on IE, the IE memory consumption increases.
      Ideally speaking if first launch is taken say for example 20MB (looking at task manager this IE instance), on refresh it should again come till 20MB and stop.
      BUT this does not happen, what you observe is second time 20MB becomes 38-40MB or so.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Test Sun's Swing applet example. Browse to
      http://java.sun.com/docs/books/tutorial/uiswing/start/swingA
      pplet.html.

      As you do this monitor the "Memory Usage" in the Windows
      Task Manager for the IEXPLORE.EXE process.

      2. Click on HelloSwingApplet.html link" At this point the
      Java Applet is intialised.

      3.Now that the applet is launched in IE, look at the task manager for this IE memory consumption

      4.Hit Refresh on IE, you would see the memory in task manager for this IE instance increases above the total consumtiom from first instance

      5.This obviously means that some part or All part from previous instance applet laucned was not recollected by garbage collector

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      1. First launch of applet in IE say for example consumes 20MB if you are looking at IE in task manager
      2.Hit Refresh
      3.Second launch of applet should show 20MB in IE, meaning all the memory consumed from First instance of applet launch must be recovered by GC on hitting refresh
      ACTUAL -
      1. First launch of applet in IE say for example consumes 20MB if you are looking at IE in task manager
      2.Hit Refresh
      3.Second launch of applet will show 38+something MB in IE, meaning all the memory consumed from First instance of applet launch is not recovered by GC on hitting refresh

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*; //This is the final package name.
      import java.awt.*;

      public class HelloSwingApplet extends JApplet {

          // This is a hack to avoid an ugly error message in 1.1.
          public HelloSwingApplet() {
              getRootPane().putClientProperty("defeatSystemEventQueueCheck",
                                              Boolean.TRUE);
          }

          public void init() {
              JLabel label = new JLabel(
                                 "You are successfully running a Swing applet!");
              label.setHorizontalAlignment(JLabel.CENTER);

              //Add border. Should use createLineBorder, but then the bottom
              //and left lines don't appear -- seems to be an off-by-one error.
              label.setBorder(BorderFactory.createMatteBorder(1,1,2,2,Color.black));

              getContentPane().add(label, BorderLayout.CENTER);
          }
      }

      ---------- END SOURCE ----------

            ccheung Calvin Cheung
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: