Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Yet another OutOfMemory thread(OutOfMemoryError on one hand, can't create JVM on another)
Yet another OutOfMemory thread [message #1121387] Mon, 30 September 2013 15:15 Go to next message
ILya Cyclone is currently offline ILya CycloneFriend
Messages: 19
Registered: June 2013
Junior Member
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 #1124327 is a reply to message #1121387] Thu, 03 October 2013 12:28 Go to previous messageGo to next message
ILya Cyclone is currently offline ILya CycloneFriend
Messages: 19
Registered: June 2013
Junior Member
Anybody here?

I've solved this issue by switching my IDE to 64 bit JDK. This made possible to start IDE with -Xmx2048M and generate a report.

I'm asking you WHY generating a single report with ONE page requires this great amount of memory?
I don't understand it.

[Updated on: Fri, 04 October 2013 12:45]

Report message to a moderator

Re: Yet another OutOfMemory thread [message #1142703 is a reply to message #1124327] Thu, 17 October 2013 20:12 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1663
Registered: July 2009
Senior Member

I'm not certain why you're having this issue. Are you using the POJO runtime or the OSGi runtime? Glad switching JDK's worked for you.

Michael

Add interactivity, scheduling, sharing, live Excel export, and JS integration to your BIRT app with the new, free BIRT server, BIRT iHub F-Type.
Re: Yet another OutOfMemory thread [message #1148308 is a reply to message #1142703] Mon, 21 October 2013 12:11 Go to previous message
ILya Cyclone is currently offline ILya CycloneFriend
Messages: 19
Registered: June 2013
Junior Member
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 12:20]

Report message to a moderator

Previous Topic:What is the difference between table column binding and data element column binding
Next Topic:BIRT 4.3 and RAD 8.0.4.1
Goto Forum:
  


Current Time: Mon Nov 24 18:10:32 GMT 2014

Powered by FUDForum. Page generated in 0.01765 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software