https://issues.apache.org/bugzilla/show_bug.cgi?id=46863


Cameron McCormack <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO




--- Comment #2 from Cameron McCormack <[email protected]>  2009-03-18 20:30:47 
PST ---
(In reply to comment #1)
> Created an attachment (id=23388)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23388) [details]
> Untested patch adapted from proposal

Thanks.

> First of all, I'm not sure if we should fix this, as it's a Java bug -- should
> this be marked as invalid instead?

If we can easily work around a known problem, I think we should.

> Nevertheless, by making a short investigation and taking a look at the class
> documentation [1], it seems that simply replacing finish() by close() would 
> fix
> this and also shouldn't hurt anything so here goes an untested patch.

Interestingly, it seems Sun's DeflaterOutputStream won't call end() on its
Deflater from inside DeflaterOutputStream.close() if a Deflater was supplied to
the DeflaterOutputStream constructor.  We might need to call end() on the
Deflater directly.  But I'd like to test this first, so...

> If anyone has the opportunity to review/test this patch, please follow up with
> results. Other proposals are (naturally) welcome. :-)

...liamsb, can you provide a short test case that demonstrates the OOM problem?
 I tried with this small test of PNGImageEncoder, but memory usage didn't grow:

import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import org.apache.batik.ext.awt.image.codec.png.PNGImageEncoder;

public class A {
    public static void main(String[] args) {
        BufferedImage bi = new BufferedImage(100, 100,
BufferedImage.TYPE_INT_ARGB);
        for (;;) {
            PNGImageEncoder e = new PNGImageEncoder(new
ByteArrayOutputStream(), null);
            try {
                e.encode(bi);
            } catch (IOException ex) {
            }
        }
    }
}

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to