Duplicate :
|
|
Relates :
|
|
Relates :
|
chosho.kyo@japan 1998-09-05 (1) Working environments OS : Solaris2.5.1 Japanese version Browser : Netscape Communicator4.04J Java Plug-in : Java Plug-in 1.1.1 g JRE : JRE1.1.6 within Plug-in Window : CDE Japanese Input : Atok7 (2) Phenomenon Step1: Start NC with Java Plug-in. Step2: Read a html file with applet. Step3: Read another html file with another applet. Step4: Repeat Step3 over and over to read other html with different applet. The memory size of Java VM increases without any limitation. Sometimes netscape will show a dialog window say:[Plugin: Java VM process has died.]. I have got the new test programs for reproducing BugId:4171490 from Ntt Comware. Please check them. (1) Working environments OS : Solaris2.5.1 Japanese version Browser : Netscape Communicator4.04J Java Plug-in : Java Plug-in 1.1.1 g JRE : JRE1.1.6 within Plug-in Window : CDE Japanese Input : Atok7 (2) Test steps [Step1] Compile F1main.java and F2main.java [Step2] Build a environment to run both applets above. Assume there is a WWW environment called http://speed.japan/~kyo/ and make directories as follows. $mkdir test $cd test $mkdir Frame2 Put F1main.class, F1Thread.class and all HTML files under the directory test. Put F2main.class under the directory test/F2main. [Step3] Read http://speed.japan/~kyo/test/sample.html The above address is a real one, you can access it directly. [Step4] Two frames appear and then you can test it. Click start button on the upper frame, then a lower frame will be reloaded automaticlly until you click the stop button of the upper frame. [Step5] Observe the growth of the memory state like following. $ps -u username -o pmem,fname | grep java_vm You will find the memory of the java_vm grows indefinitely. /*----------F1main.java-----------*/ import java.applet.*; import java.awt.*; import java.awt.event.*; import java.net.*; public class F1main extends Applet implements ActionListener{ public Label tf = null; private F1Thread f1Thread; private Button startButton; private Button stopButton; public void init(){ setLayout(new GridLayout(4,1)); // Create Version Label add(new Label("Auto HTML read program ver 1.0")); // Create Counter Fileld tf = new Label(); add(tf); // Create Start Button startButton = new Button("start"); startButton.addActionListener(this); add(startButton); //Create StopButton stopButton = new Button("stop"); stopButton.addActionListener(this); stopButton.setEnabled(false); add(stopButton); } public void actionPerformed(ActionEvent e){ if(e.getSource() == startButton){ startButton.setEnabled(false); stopButton.setEnabled(true); f1Thread = new F1Thread( this, tf ); } if(e.getSource() == stopButton){ startButton.setEnabled(true); stopButton.setEnabled(false); f1Thread.stop(); } } } class F1Thread extends Thread{ private Label setl = null; private String http = null; private Applet parent = null; static final private String htmlFile = "F2main.html"; public F1Thread(Applet parent, Label tf){ URL url; String host; String base; int pos; this.setl = tf; this.parent = parent; // Create URL Address url = parent.getDocumentBase(); host = url.getHost(); base = url.getFile(); base = base.substring(0,base.lastIndexOf("/")+1); http = "http://"; http += host; http += base; http += htmlFile; this.start(); } public void run(){ for(int i=0;;i++){ try{ parent.getAppletContext().showDocument(new URL(http), "FRAME2"); this.setl.setText(Integer.toString(i)); sleep(5000); } catch(Exception e){ System.out.println("F1Thread " + e.toString()); return; } } } } /*----------F2main.java-----------*/ import java.applet.*; import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; public class F2main extends Applet{ public void init(){ setLayout(new GridLayout()); Label label = new Label("This is F2main."); add(label); } } ------------F1main.html------------- <HTML> <!--"CONVERTED_APPLET"--> <!-- CONVERTER VERSION 1.0 --> <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 400 HEIGHT = 100 codebase="http://java.sun.com/products/plugin/1.1/jinstall-11-win32.cab#Ver sion=1,1,0,0"> <PARAM NAME = CODE VALUE = F1main.class > <PARAM NAME="type" VALUE="application/x-java-applet;version=1.1"> <COMMENT> <EMBED type="application/x-java-applet;version=1.1" java_CODE = F1main.class WIDTH = 400 HEIGHT = 100 pluginspage="http://java.sun.com/products/plugin/1.1/plugin-install.html"> <NOEMBED></COMMENT> </NOEMBED></EMBED> </OBJECT> <!-- <APPLET CODE = F1main.class WIDTH = 400 HEIGHT = 100 > </APPLET> --> <!--"END_CONVERTED_APPLET"--> </HTML> ------------F2main.html------------- <HTML> <!--"CONVERTED_APPLET"--> <!-- CONVERTER VERSION 1.0 --> <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 400 HEIGHT = 100 codebase="http://java.sun.com/products/plugin/1.1/jinstall-11-win32.cab#Ver sion=1,1,0,0"> <PARAM NAME = CODE VALUE = F2main.class > <PARAM NAME = CODEBASE VALUE = "Frame2" > <PARAM NAME="type" VALUE="application/x-java-applet;version=1.1"> <COMMENT> <EMBED type="application/x-java-applet;version=1.1" java_CODE = F2main.class java_CODEBASE = "Frame2" WIDTH = 400 HEIGHT = 100 pluginspage="http://java.sun.com/products/plugin/1.1/plugin-install.html"> <NOEMBED></COMMENT> </NOEMBED></EMBED> </OBJECT> <!-- <APPLET CODE = F2main.class CODEBASE = "Frame2" WIDTH = 400 HEIGHT = 100 > </APPLET> --> <!--"END_CONVERTED_APPLET"--> </HTML> ------------sample.html------------- <HTML> <HEAD> <TITLE>Applet Reload test</TITLE> </HEAD> <FRAMESET ROWS="50%,50%"> <FRAME SRC="F1main.html" NAME="FRAME1"> <FRAME SRC="F2main.html" NAME="FRAME2"> </FRAMESET> </HTML> chosho.kyo@japan 1998-09-10
|