Hi all. If you read to the end of this message I'd appreciate it - first a
little background so you know what I'm on about..

I've been developing a servlet system over the past 9 months. One part
of it involves receiving a jpeg file via http upload and processing it.
The system is running on Apache JServ with Apache on Redhat linux 6.0 on a
PIII-450/512mb RAM. JVM is Blackdown's 1.2 JDK.

Processing an image involves:

Creating a thumbnail image and saving that under the htdocs directory.
Creating a larger thumbnail image and compositing it with another image,
then saving it under the htdocs directory.
Moving the original image to another directory.

The images are reasonably large - up to 3000x3000 pixels, but more often
around 2000x1500.

I've developed several solutions to this task, including:

AWT all the way. JpegEncoder to write the images.
JAI all the way.
JAI to read the image, Java 2D for processing, JpegEncoder for writing.

No matter what I do, the system always runs out of memory after a dozen or so
images are processed. Watching the memory usage on the server before and
after each image is processed, I see that the JServ java processes increase
by 5-6mb each time until it's full. This shouldn't happen right?

I've been very careful with the code to make sure there is no static code
that could be messing things up and all variables are instance (that is,
defined within the main method). In JAI, I've told it to use a cache of size
zero to prevent it from caching tiles.

I'm out of ideas for java so I'm currently writing a C program that uses
the Image Magick API to do the processing. I'll call this from the servlet
via JNI. I'm pissed that I have to resort to that because every other part
of the system is platform-independant.

If I can't make that work then I'll have to go to some kind of delayed
processing using perl and a cron job I think.

It's bloody depressing to think that for all java's good points (it is a
great language) it is INCAPABLE of processing images in real time, one
after the other indefinately.

If you've got any great ideas I'd love to hear them. This really sucks
and I will think carefully about using java for the next big project if
it has such showstopping limitations as this.

Zach Bagnall.

JServ is 1.0
Apache is 1.3.6 with DSO support
JVM is jdk1.2-prev2

===========================================================================
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