• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Memory Leak with JTextArea

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im having a problem with using a JTextArea.

When I display around 10Megs of text in it, it requires well over 100 megs of RAM (actuall used memory is 100Megs, while me heap is at like 160Megs).

WHY ??? This is totally unreasonable.

How do I fix this?
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you entering the text into the JTextArea? If you're creating a bunch of Strings, that could be the problem.
 
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe this is actually a known problem that's persisted since something like 1999. There was recently someone complaining about the same thing on these forums, but I can't find the thread now. Maybe if you do a search that will help. There is some discussion here of a similar (if not the same) issue.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!