Yet another OutOfMemory thread [message #1121387] |
Mon, 30 September 2013 11:15  |
Eclipse User |
|
|
|
Hello.
This is just another thread about BIRT TREMENDOUS memory consumption.
I'm using Birt Engine jars in JDeveloper to run a simple report - there's just one page and two queries of 1-2 rows from Oracle.
Here's the code: in the bottom or pastebin.com/itgxe9gi (just one class with main() method).
First of all is the code correct?
With current memory options "-Xms512m -Xmx1024m -XX:MaxPermSize=512m" it gives error:
There is insufficient memory to execute this report.
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
Adding more space like "-Xmx2048m" leads to "Unable to create JVM instance" on IDE start.
I'm on 8Gm RAM machine and I'm unable to run a simple report.
What am I left to do?
BIRT version is 4.3
Thanks.
package birttest;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.birt.core.exception.BirtException;
import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.engine.api.EngineConfig;
import org.eclipse.birt.report.engine.api.EngineException;
import org.eclipse.birt.report.engine.api.HTMLCompleteImageHandler;
import org.eclipse.birt.report.engine.api.HTMLRenderOption;
import org.eclipse.birt.report.engine.api.IRenderOption;
import org.eclipse.birt.report.engine.api.IReportEngine;
import org.eclipse.birt.report.engine.api.IReportEngineFactory;
import org.eclipse.birt.report.engine.api.IReportRunnable;
import org.eclipse.birt.report.engine.api.IRunAndRenderTask;
import org.eclipse.birt.report.engine.api.PDFRenderOption;
import org.eclipse.birt.report.engine.api.RenderOption;
public class SimpleTest {
public SimpleTest() {
super();
}
// ===========================================
// java.lang.OutOfMemoryError: Java heap space
// ===========================================
private static final String RPT_PATH = "D:\\eclipse_workspace\\Admission\\Admission.rptdesign",
// "D:\\birt\\BirtWeb\\test.rptdesign"
BIRT_HOME = "D:\\birt\\birt-runtime-4_3_0\\ReportEngine";
public static void main(String[] args) {
// Create an EngineConfig object.
EngineConfig config = new EngineConfig();
// Set up the path to your BIRT home directory.
config.setBIRTHome(BIRT_HOME);
//( "C:/Program Files/birt-runtime-2_6_0/ReportEngine" );
// Start the platform for a non-RCP application.
IReportEngine engine = null;
try {
Platform.startup(config);
IReportEngineFactory factory =
(IReportEngineFactory)Platform.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
// Set up writing images or charts embedded in HTML output.
HTMLRenderOption renderOptions = new HTMLRenderOption();
renderOptions.setImageHandler(new HTMLCompleteImageHandler());
config.setEmitterConfiguration(RenderOption.OUTPUT_FORMAT_HTML, renderOptions);
//
// IRenderOption renderOptions = new PDFRenderOption();
// config.setEmitterConfiguration(RenderOption.OUTPUT_FORMAT_PDF, renderOptions);
// Create the engine.
engine = factory.createReportEngine(config);
IReportRunnable design = null;
try {
design = engine.openReportDesign(RPT_PATH);
// Create a run and render task object.
IRunAndRenderTask task = engine.createRunAndRenderTask(design);
Map<String, Object> parameterValues = new HashMap<String, Object>();
parameterValues.put("id_wu", "64285");
task.setParameterValues(parameterValues);
// Validate parameter values.
boolean parametersAreGood = task.validateParameters();
System.out.println("parametersAreGood = " + parametersAreGood);
// Set the name of an output file and other HTML options.
// IRenderOption renderOptions = new PDFRenderOption();
// renderOptions.setOutputFormat(renderOptions.OUTPUT_FORMAT_PDF);
String output = "d:\\report.html";
renderOptions.setOutputFileName(output);
task.setRenderOption(renderOptions);
task.run();
task.close();
// IRunAndRenderTask task = engine.createRunAndRenderTask(design);
// Set values for all parameters in a HashMap, parameterValues
//task.setParameterValues( parameterValues );
// Validate parameter values.
//boolean parametersAreGood = task.validateParameters( );
// Set the name of an output file and other HTML options.
// HTMLRenderOption options = new HTMLRenderOption();
// String output = "d:\\report.html"; // name.replaceFirst( ".rptdesign", ".html" );
// options.setOutputFileName(output);
// options.setImageDirectory("image");
// options.setEmbeddable(false);
// Apply the rendering options to the
// task.setRenderOption(options);
//
// task.run();
// task.close();
// engine.destroy();
} catch (EngineException e) {
System.err.println("Design not found!");
// engine.destroy();
System.exit(-1);
}
// Get the value of a simple property.
// String title = (String)design.getProperty(IReportRunnable.TITLE);
} catch (BirtException e) {
e.printStackTrace();
} finally {
if (engine != null) {
engine.destroy();
}
Platform.shutdown();
}
}
}
|
|
|
|
|
Re: Yet another OutOfMemory thread [message #1148308 is a reply to message #1142703] |
Mon, 21 October 2013 08:11  |
Eclipse User |
|
|
|
Hello Michael,
It is just that code in just one class.
I've downloaded Runtime from common BIRT download page. So I guess it is POJO.
Still need explanation on memory consumption. This report is tiny cut it requires up to 2 Gb RAM.
Is it normal?
[Updated on: Mon, 21 October 2013 08:20] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03341 seconds