> From: NoKideen [mailto:[EMAIL PROTECTED] 
> usually I use String to collect output first and out.print() 
> those String
> example :
> String a="";
> a+="Test 1";
> a+="Test 2";
> //.... very long , and almost 1 page 
> 
> out.println(a);
> 
> can this cause out of memory problem ?

It won't help much - you'll build up String objects very quickly.  See
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/StringBuffer.html for
a better approach that won't leave so many string fragments lying
around, roughly:

StringBuffer a = new StringBuffer();
a.append("Test 1");
a.append("Test 2");
...
out.println(a.toString());

However, this will merely cause the GC to run more frequently; it won't
run you out of memory.  Something else is causing that.

                - Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to