-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.1.3
-
None
-
x86
-
windows_95
Name: diC59631 Date: 09/26/97
Running under JDK 1.1.x (or latest release of Netscape Communicator),
an applet/app with a TextArea having text continually appended causes
Windows '95 allocated memory and swap-file size to gradually increase -
viewed using Win '95 System Monitor - until PC hangs.
This problem does not appear under JDK 1.0.2/IE3/IE4.
Sample source:
// TaTest.java
import java.applet.*;
import java.awt.*;
public class TaTest extends Applet implements Runnable
{
private Thread m_TaTest = null;
private boolean m_fStandAlone = false;
private TextArea ta;
public static void main(String args[])
{
TaTestFrame frame = new TaTestFrame("TaTest");
frame.show();
frame.hide();
frame.resize(frame.insets().left + frame.insets().right + 400,
frame.insets().top + frame.insets().bottom + 300);
TaTest applet_TaTest = new TaTest();
frame.add("Center", applet_TaTest);
applet_TaTest.m_fStandAlone = true;
applet_TaTest.init();
applet_TaTest.start();
frame.show();
}
public void init()
{
resize(400, 300);
setLayout( new BorderLayout() );
ta = new TextArea(15,50);
add("Center", ta);
}
public void start()
{
if (m_TaTest == null)
{
m_TaTest = new Thread(this);
m_TaTest.start();
}
}
public void stop()
{
if (m_TaTest != null)
{
m_TaTest.stop();
m_TaTest = null;
}
}
public void run()
{
int i=0;
while (true)
{
try
{
ta.appendText("\nTextArea test Applet - " + i++ );
if( i % 500 == 0 ){
ta.setText("");
}
Thread.sleep(100);
}
catch (InterruptedException e)
{
stop();
}
}
}
}
class TaTestFrame extends Frame
{
public TaTestFrame(String str)
{
super (str);
}
public boolean handleEvent(Event evt)
{
switch (evt.id)
{
case Event.WINDOW_DESTROY:
// TODO: Place additional clean up code here
dispose();
System.exit(0);
return true;
default:
return super.handleEvent(evt);
}
}
}
// TaTest.html
<html>
<head>
<title>TaTest</title>
</head>
<body>
<hr>
<applet
code=TaTest.class
name=TaTest
width=400
height=300 >
</applet>
<hr>
</body>
</html>
company - ScottishTelecom , email - ###@###.###
======================================================================
- duplicates
-
JDK-4068639 Memory Leak(s)
-
- Closed
-