[Advanced-java]
Workaround for Bug 4724129: StringBuffer.toString() not clear
Nikolaos Giannopoulos
nikolaos at solmar.ca
Tue Apr 1 21:57:18 2003
We have been seeing java.lang.OutOfMemoryError's when using Tomcat 4.1.12
with JRE 1.4.1_01 for some time now.
I found bug 4724129 which seems to have been introduced in 1.4.1_XX and
seems to be the only culprit (BTW we are not using JSPs - which is affected
by another bug).
The workaround seems to be not to re-use StringBuffer which is easy enough
to understand but what I don't seem to get is the stated workaround (if I
choose to re-use StringBuffers). The workaround reads:
"Don't reuse StringBuffers. If you do reuse them, check their capacity and
make sure that you aren't making tiny Strings from huge StringBuffers"
The work-around doesn't seem very clear....
Can anyone translate this to code?
Any help is appreciated. Thanks.
--Nikolaos