I am using SVGGraphics2D to write Swing JComponents to SVG but seem to
be encountering a memory leak under Websphere(3.5.4 running Java 1.2.2)
running on AIX. My code is very similar to the SVGGraphics2D demo code.
This code gets called repeatedly and leaks about 2 MBs per run. If I
comment out the SVG code(but still create my chart object) the leak goes
away. Any ideas of what could be happening? I dispose of the
SVGGraphics2D object but that didn't help.
---------------------------
Chart ch = getChart(); // Chart extends JComponent
// Get a DOMImplementation
DOMImplementation domImpl =
GenericDOMImplementation.getDOMImplementation();
// Create an instance of org.w3c.dom.Document
Document document = domImpl.createDocument(null, "svg", null);
// Create an instance of the SVG Generator
SVGGraphics2D svgGenerator = new SVGGraphics2D(document);
// Turn off double-buffering, otherwise the SVG will be a bitmap
setAllDoubleBuffered(frame.getRootPane(), false);
ch.revalidate();
frame.getRootPane().invalidate();
frame.getRootPane().validate();
ch.paint(svgGenerator);
ch = null;
// Write the SVG to the output.
Writer out = null;
try {
out = new OutputStreamWriter(str, "UTF-8");
svgGenerator.stream(out, true);
} finally {
if(out != null) {
out.close();
out = null;
}
}
// Release the SVG object from memory
svgGenerator.dispose();
svgGenerator = null;
domImpl = null;
document = null;
------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]