aspose file tools*
The moose likes Java in General and the fly likes OutOfMemoryError eventhough i increased memory size by -Xmx1024m also Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "OutOfMemoryError eventhough i increased memory size by -Xmx1024m also" Watch "OutOfMemoryError eventhough i increased memory size by -Xmx1024m also" New topic
Author

OutOfMemoryError eventhough i increased memory size by -Xmx1024m also

rama kammari
Greenhorn

Joined: Jun 14, 2012
Posts: 9
Jelle Klap
Bartender

Joined: Mar 10, 2008
Posts: 1836
    
    7

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.

Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: OutOfMemoryError eventhough i increased memory size by -Xmx1024m also