Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

OutOfMemoryError eventhough i increased memory size by -Xmx1024m also

 
rama kammari
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Jelle Klap
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It all depends on how many images you're retrieving from how many different URLs and how large those images are. You seem to be storing all of the BufferedImages in some reference called imageCache, which I guess is a Map of some sort. If you don't evict from that cache eventually all that image data is going to fill up the heap, and as image data usually has a relatively large memory foorprint that could happen quite fast. Also, you're using ImageIO to read from an InputStream, but you don't seem to be closing that InputStream anywhere in this code fragement. Make sure you do, because ImageIO won't do it for you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic