Since I am using a bean to create thumbnails as a part of a web project teh
mx options is not applicable?
I thought memory allocation is auto in Java ...am I missing something ? I
could not find anywhere how to allocate memory in Java ??

Please help!

-----Original Message-----
From: Irving Salisbury [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 28, 2000 7:02 PM
To: Mokashi, Swanand
Subject: Re: [JAVA2D] java.lang.OutOfMemoryError: WITH Toolkit


You can get an OutOfMemory error because you are trying to allocate more
memory
than the VM currently has available.  Of course, the VM is not smart enough
to
garbage collect and then try it again.  This is a very common thing that
happens
with large single allocations.  I use the following:

try {
    // huge allocation
}catch( OutOfMemoryError e ){
    Runtime.getRuntime().gc();
    Runtime.getRuntime().runFinalization();
    // try huge allocation again
}

If there really is enough memory, this will work.  We have a large imaging
system we have written, and have this code peppered a lot of places.

Irv

"Mokashi, Swanand" wrote:

> I am trying to load an image using the Toolbox class provided with the
book
> " Java 2d API Graphics " by Vincent Hardy. The Toolbox class basically
> implements the Toolkit class
>
> I am trying to load an image with
> image = Toolbox.loadImage(imageName, BufferedImage.TYPE_INT_RGB);
>
> This works great with small images (in memory size) ..However for large
> images this fails and gives these errors :
>
> java.lang.OutOfMemoryError:
> at
sun.awt.image.ImageRepresentation.setPixels(ImageRepresentation.java:468)
> at sun.awt.image.ImageDecoder.setPixels(ImageDecoder.java:127)
> at sun.awt.image.JPEGImageDecoder.sendPixels(JPEGImageDecoder.java:124)
> at sun.awt.image.JPEGImageDecoder.readImage(Native Method)
> at sun.awt.image.JPEGImageDecoder.produceImage(JPEGImageDecoder.java:150)
> at
>
sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.java:248
> )
> at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:221)
> at sun.awt.image.ImageFetcher.run(ImageFetcher.java:189)
> ServletExec.ProcessRequest() error: java.lang.OutOfMemoryError:
> java.lang.OutOfMemoryError:
> at java.awt.image.DataBufferInt.<init>(DataBufferInt.java:48)
> at java.awt.image.Raster.createPackedRaster(Raster.java:404)
> at
>
java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorMo
> del.java:637)
> at java.awt.image.BufferedImage.<init>(BufferedImage.java:245)
> at com.sun.glf.util.Toolbox.loadImage(Toolbox.java:209)
> at com.sun.glf.util.Toolbox.loadImage(Toolbox.java:184)
> at swanand.ImageSize.<init>(ImageSize.java:23)
> at
>
ImageManipulation.OffscreenBufferRendering.Manipulate(OffscreenBufferRenderi
> ng.java:84)
> at
>
pagecompile._imagemanipulation._default_xjsp._jspService(_default_xjsp.java:
> 54)
> at newatlanta.servletexec.JSP10HttpJspPage.service(JSP10HttpJspPage.java)
> at newatlanta.servletexec.JSP10Servlet.service(JSP10Servlet.java)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:840)
>
> Please help !!
>
>
===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff JAVA2D-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to