Bug 194549 Memory leak in chart device renderers
After memory analysis for Chart code, it indicates java.awt.Font objects are not garbage collected. Investigating the renderer code, Graphics2D objects in IDisplayServer and IDeviceRenderer are not disposed after chart rendering finished. Need to invoke IDeviceRenderer.dispose() after ChartReportItemPresentationImpl being finished, and dispose all required resources in that method, including IDisplayServer and anything else.
chart/org.eclipse.birt.chart.device.pdf/src/org/eclipse/birt/chart/device/pdf/PDFRendererImpl.java
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.StringReader;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.apache.batik.transcoder.DefaultErrorHandler;
import org.apache.batik.transcoder.TranscoderException;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;
import org.apache.fop.svg.PDFTranscoder;
import org.eclipse.birt.chart.device.IDeviceRenderer;
import org.eclipse.birt.chart.device.svg.ISVGConstants;
import org.eclipse.birt.chart.device.svg.SVGRendererImpl;
import org.eclipse.birt.chart.device.svg.plugin.ChartDeviceSVGPlugin;
import org.eclipse.birt.chart.event.InteractionEvent;
import org.eclipse.birt.chart.exception.ChartException;
import org.eclipse.birt.chart.log.ILogger;
import org.eclipse.birt.chart.log.Logger;
import org.eclipse.birt.chart.util.PluginSettings;
import org.w3c.dom.Document;
/**
 * Provides a reference implementation of a PDF device renderer. It uses the Batik SVG Toolkit to transcode
 * SVG generated output to PDF format.
 */
public class PDFRendererImpl extends SVGRendererImpl {