dcsimg
java.lang.OutOfMemoryError: Java heap space
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   beena_kp
Posted On:   Friday, March 17, 2006 05:39 AM

Hi, My java application is a multi-threaded one. Each thread will do the following. 1. Read the byte array from a stream 2. Convert this byte array to image 3. Paint it on a canvas. The code that I am using is this. bis = new ByteArrayInputStream(imageData, 0, imageData.length); decoder = JPEGCodec.createJPEGDecoder(bis); image = decoder.decodeAsBufferedImage(); The memory utilization is high in the line 'decoder = JPEGCodec.createJPEGDecoder(bis);' . Can any one help me.. Thanks in advance    More>>

Hi,


My java application is a multi-threaded one. Each thread will do the following.

1. Read the byte array from a stream

2. Convert this byte array to image

3. Paint it on a canvas.

The code that I am using is this.

			
bis = new ByteArrayInputStream(imageData, 0, imageData.length);
decoder = JPEGCodec.createJPEGDecoder(bis);
image = decoder.decodeAsBufferedImage();


The memory utilization is high in the line 'decoder = JPEGCodec.createJPEGDecoder(bis);' . Can any one help me..

Thanks in advance    <<Less

Re: java.lang.OutOfMemoryError: Java heap space

Posted By:   Abhijai_Kapadnis  
Posted On:   Tuesday, March 21, 2006 12:52 AM

Hello
Just increase your heap size using following command:

java -Xms32m -Xmx128m MyClassName

Or refer to the following UR. It will surely help you
http://www.devx.com/tips/Tip/5578

Re: java.lang.OutOfMemoryError: Java heap space

Posted By:   Edward_Harned  
Posted On:   Friday, March 17, 2006 12:33 PM

Here's a hint:

Get rid of no longer needed objects.


Try setting bis, decoder and image to null as soon as you no longer need them.

About | Sitemap | Contact