https://issues.apache.org/bugzilla/show_bug.cgi?id=46863
Summary: DeflaterOutputStream not closed, causes
OutOfMemoryError
Product: Batik
Version: 1.7
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: major
Priority: P2
Component: SVGGraphics2D
AssignedTo: [email protected]
ReportedBy: [email protected]
The close() method should be called on java.util.zip.DeflaterOutputStream
instances when they are no longer needed. In particular, the writeIDAT() and
writeZTXT() methods in org.apache.batik.ext.awt.image.codec.png.PNGImageEncoder
do not call close() on DeflaterOutputStream.
Since close() is not called, end() is not called on the java.util.zip.Deflater
instance until it is garbage collected. Due to the implementation of Deflater,
this causes an OutOfMemoryError to occur in some cases when the PNGImageEncoder
is invoked repeatedly. This issue with Deflater is described in detail at
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4797189, where the
recommended solution is to ensure that end() is called on the Deflater in a
timely fashion.
Tested in Batik versions 1.5 and 1.7.
Stack trace:
[...]
Caused by: java.lang.OutOfMemoryError
at java.util.zip.Deflater.init(Native Method)
at java.util.zip.Deflater.<init>(Deflater.java:134)
at java.util.zip.Deflater.<init>(Deflater.java:143)
at org.apache.batik.ext.awt.image.codec.PNGImageEncoder.writeIDAT(Unknown
Source)
at org.apache.batik.ext.awt.image.codec.PNGImageEncoder.encode(Unknown
Source)
at org.apache.batik.svggen.ImageHandlerBase64Encoder.encodeImage(Unknown
Source)
at org.apache.batik.svggen.ImageHandlerBase64Encoder.handleHREF(Unknown
Source)
at org.apache.batik.svggen.ImageHandlerBase64Encoder.handleHREF(Unknown
Source)
at org.apache.batik.svggen.DefaultImageHandler.handleImage(Unknown Source)
at org.apache.batik.svggen.SimpleImageHandler.handleImage(Unknown Source)
at org.apache.batik.svggen.SVGGraphics2D.drawImage(Unknown Source)
at org.apache.batik.svggen.SVGGraphics2D.drawImage(Unknown Source)
[...]
--
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]