I'm also having another problem with this code. The Chart is being printed to SVG as if it was not fully validated(e.g. objects are misaligned and overlapping). Any ideas of what I'm doing wrong?
-----Original Message----- From: Brian Jackson [mailto:[EMAIL PROTECTED]] On Behalf Of [EMAIL PROTECTED] Sent: Tuesday, February 18, 2003 6:42 PM To: 'Batik Users' Subject: Memory leak in SVGGraphics2D? 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
