Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

java.lang.OutOfMemoryError

Status
Not open for further replies.

spankweat

Technical User
Jul 27, 2001
13
US
Exception in thread "main" java.lang.OutOfMemoryError
<<no stack trace available>>

... my program is just parsing a text file of about 200 lines. It looks for the following character &quot;.

Anybody had this problem before?
 
Use StringBuffer instead of String (which is what I suspect is your problem). String Objects are immutable (which is fancy talk for they can't change) so anytime you manipulate a String in Java a new Object is created in memory and the reference is updated.

In most of these types of cases the use of StringBuffer will completely solve the memory problem. Without anymore information (ie code) that is the best suggestion I can make. Wushutwist
 
Well the problem is that I am using StringBuffer().insert
and String doesnot have this method.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top