I have just determined, after weeks of frustrating problems, that
ImageIO.setUseCache(false) is the likely source of serious bugs when
loading images.

Symptoms: PNG images get row error exceptions and sometimes zip
exceptions, JPG images get distorted. These problems get worse depending
on network environment (i.e., applets) and/or whether WebStart is being
used.

As soon as I commented out ImageIO.setUseCache(false); in my code, all
the problems went away.

I can only assume there is some sort of memory mismanagement problem
going on - perhaps the GC is freaking out causing thread sync problems
because it can't allocate memory fast enough, I don't know. I typically
use -Xms100m, but even when the image and second buffer are smaller than
that the problems happen.

Note, there is already a bug report (4821108) open on this issue and the
people responsible have been notified.

One lesson learned, it is safer to load PNG than JPG because you get an
exception thrown when something goes wrong, with JPG, no such luck. I
wonder if JP2 image decoders catch problems and throw exceptions?

Cheers, Eric

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