Printing causes memory leak in applet
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Sruli_Ganor
Posted On:   Sunday, April 27, 2003 11:53 PM

Hi Java gurus, I have an applet that runs for a long time and its memory grows enourmously. After some tests I found that the problem is with System.out.println(). You can reproduce it yourself simply as follows: public class MemTest extends java.applet.Applet { String longString = "A long string of 250 characters ..."; public void init() { for (int i=0; i <4000; i++) System.out.println(longString); } } My applet writes a lot of traces to the Java Console for troubleshooting. Is this a known problem? Is there a solution? The problem occurs on IE and Netscape with Java plugin 1.4, or when running with 1.   More>>

Hi Java gurus,


I have an applet that runs for a long time and its memory grows enourmously. After some tests I found that the problem is with System.out.println(). You can reproduce it yourself simply as follows:


			
public class MemTest extends java.applet.Applet {
String longString = "A long string of 250 characters ...";
public void init() {
for (int i=0; i <4000; i++)
System.out.println(longString);
}
}


My applet writes a lot of traces to the Java Console for troubleshooting. Is this a known problem? Is there a solution?


The problem occurs on IE and Netscape with Java plugin 1.4, or when running with 1.1 with no plugin. It does not happen in AppletViewer.


Thanks in advance


Sruli Ganor

   <<Less
About | Sitemap | Contact