• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Memory optimization tips needed

 
landon manning
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Basic problem: My java program is using too much memory.
Does anyone have any good memory optimization tips for java?
On a related note, does anyone know the amount of memory that some of the more common Objects use? (ie. Strings, Integers, Threads)
Thanks
Landon Manning
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use StringBuffer to do all your String concatinations.
On the size, I can only speculate. You can use Runtime.freeMemory() before and after creating an object to help determine this information if you want.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic