Hi
I've got a memory problem using batik to convert swing objects to svg:
whenever I call the listed method heap increases (but never releases memory
after method has finished):
public static final void convert(JComponent swing, OutputStream out) {
DOMImplementation domImpl =
GenericDOMImplementation.getDOMImplementation();
// Create an instance of org.w3c.dom.Document
org.w3c.dom.Document document =
domImpl.createDocument("http://www.w3.org/2000/svg", "svg:svg", null);
// Create an SVG Context to customise
SVGGeneratorContext ctx =
SVGGeneratorContext.createDefault(document);
// Create an instance of the SVG Generator
SVGGraphics2D svgGenerator = new SVGGraphics2D(ctx, false);
swing.setSize(new
Dimension(Constants.PRINT_OBJECT_WIDTH,Constants.PRINT_OBJECT_HEIGHT));
svgGenerator.setSVGCanvasSize(new
Dimension(Constants.PRINT_OBJECT_WIDTH,Constants.PRINT_OBJECT_HEIGHT));
SwingSVGPrettyPrint.print(swing, svgGenerator);
OutputStreamWriter writer = null;
writer = new OutputStreamWriter(out);
/*
try {
writer = new OutputStreamWriter(out,Constants.ENCODING);
} catch (UnsupportedEncodingException e1) {
System.out.println("Unsupported encoding");
writer = new OutputStreamWriter(out);
}*/
try {
svgGenerator.stream(writer, false);
try {
writer.flush();
out.flush();
writer.close();
out.close();
//System.out.println(out.toString());
} catch (IOException e) {
e.printStackTrace();
}
} catch (SVGGraphics2DIOException e) {
e.printStackTrace();
} finally {
svgGenerator.dispose();
svgGenerator = null;
document = null;
domImpl = null;
}
}
svgGenerator.dispose() has no effect. Any ideas?
--
View this message in context:
http://www.nabble.com/Memory-leak--tf4019147.html#a11414837
Sent from the Batik - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]