How to avoid this java.lang.OutOfMemory Exception?

Helo All,

I am working on servlets and created a scan component which scans muliple documents and uploads at a time to the server.The default resoultion for scanner (setXResolution) is 200 but i want it to be dymaically set for each time it is scanned .so i kept a Combobox which allows the user to select the resolution synamically when ever it takes a new Scan.So while acquring the Scanner image while setting its properties i am setting the resolution dynamically.Now,here the problem is when i am scanning more than 5 to 10 images of 300 resoultion it is giving Java.lang.OutOfMemory exception and i increased the buffer size also.once this comes all the above scanned images of 300 res also changes in to 0 kb though its is acquired in above.i am using JTwain component for this.Please hepl me out to avoid this error?How to clear the buffers dynamically ?Or any other solution to work out this erro?Please help me ?

Thanks in adavance

sirikiran

[979 byte] By [SIRIKIRANa] at [2007-10-2 9:06:10]
# 1

So you read scanned images in your Java application? 10 images of 300 resolution (probably tif?) is a lot of memory. Hope you startet Java with -Xmx and 1000 mb at least? Other than that your "JTwain" component could have a memory leak. Or you need to call a specific method to release those resources. Consult the manual of this 3rd party component.

MartinHilperta at 2007-7-16 23:13:11 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 2

Hi,

Yes i am reading the scanned images from java application.Theses images are in jpeg and i am compressing in to jp2.can u please help me whats the best method to release the resouces in this process.I am running finialzation and garbage collector after every scan.Please guide me.

Thanks in advance,

Sirishakiran

SIRIKIRANa at 2007-7-16 23:13:11 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...