Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 320003

Summary: High memory consumption of ReportEngine in Excel (XLS) reports
Product: z_Archived Reporter: wolle <wschmiesing>
Component: BIRTAssignee: Birt-ReportEngine-inbox <Birt-ReportEngine-inbox>
Status: RESOLVED WORKSFORME QA Contact: Xiaoying Gu <bluesoldier>
Severity: normal    
Priority: P3 CC: bluesoldier, jouyang, xiang.li
Version: 2.5.1   
Target Milestone: 3.7.0   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
sample report none

Description wolle CLA 2010-07-15 11:29:11 EDT
Test setup: Report query returning 10.000 entries displayed as a simple table (query takes about 1400ms to execute)

When I execute this report using the ReportEngine API on Tomcat 6 BIRT requires 1GB of memory to produce an Excel report that is several MB in size.
With a heap size less than 2GB Tomcat will produce Out-Of-Memory errors with the stack-trace attached below.
Now, when I look at the heap-dump of the JVM I can see BIRT allocates zillions of "org.w3c.dom.CSSValue" objects claiming most of the heap's memory.
If it takes 1GB for creating just one report I guess my Tomcat will blow up once there is more than one user requesting a report. Any idea how to reduce memory consumption in Excel reports?


Stacktrace of OOM Error:

java.lang.OutOfMemoryError: GC overhead limit exceeded
	java.util.Arrays.copyOfRange(Arrays.java:3209)
	java.lang.String.<init>(String.java:215)
	java.lang.StringBuilder.toString(StringBuilder.java:430)
	org.eclipse.birt.report.engine.css.engine.value.FloatValue.getCssText(FloatValue.java:38)
	org.eclipse.birt.report.engine.css.engine.value.FloatValue.getCssText(FloatValue.java:93)
	org.eclipse.birt.report.engine.css.engine.value.RGBColorValue.getCssText(RGBColorValue.java:65)
	org.eclipse.birt.report.engine.css.dom.AbstractStyle.getCssText(AbstractStyle.java:202)
	org.eclipse.birt.report.engine.css.dom.AbstractStyle.getColor(AbstractStyle.java:247)
	org.eclipse.birt.report.engine.emitter.excel.StyleBuilder.createStyleEntry(StyleBuilder.java:91)
	org.eclipse.birt.report.engine.emitter.excel.StyleEngine.initStyle(StyleEngine.java:135)
	org.eclipse.birt.report.engine.emitter.excel.StyleEngine.initStyle(StyleEngine.java:199)
	org.eclipse.birt.report.engine.emitter.excel.StyleEngine.createEntry(StyleEngine.java:72)
	org.eclipse.birt.report.engine.emitter.excel.layout.ExcelLayoutEngine.addCell(ExcelLayoutEngine.java:301)
	org.eclipse.birt.report.engine.emitter.excel.ExcelEmitter.startCell(ExcelEmitter.java:233)
	org.eclipse.birt.report.engine.emitter.CompositeContentEmitter.startCell(CompositeContentEmitter.java:233)
	org.eclipse.birt.report.engine.layout.html.HTMLTableLayoutEmitter.startCell(HTMLTableLayoutEmitter.java:705)
	org.eclipse.birt.report.engine.layout.html.HTMLTableLayoutEmitter.startCell(HTMLTableLayoutEmitter.java:701)
	org.eclipse.birt.report.engine.emitter.ContentEmitterUtil.startContent(ContentEmitterUtil.java:59)
	org.eclipse.birt.report.engine.layout.html.buffer.DummyPageBuffer.startContainer(DummyPageBuffer.java:106)
	org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.start(HTMLStackingLM.java:50)
	org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:136)
	org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.resumeLayout(HTMLInlineStackingLM.java:111)
	org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.layoutNodes(HTMLInlineStackingLM.java:160)
	org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
	org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:137)
	org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
	org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
	org.eclipse.birt.report.engine.layout.html.HTMLTableBandLM.layoutChildren(HTMLTableBandLM.java:67)
	org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:137)
	org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
	org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
	org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layoutChildren(HTMLTableLM.java:132)
Comment 1 Xiaoying Gu CLA 2010-11-30 04:33:09 EST
Is there any chance you could try with the latest 2.6.1 release?
Comment 2 Xiaoying Gu CLA 2011-03-17 02:44:12 EDT
Created attachment 191380 [details]
sample report

Can not reproduce this issue with 2.5.1 release on Tomcat 6 + jdk1.5 + WebViewerExample. The sample report contains 17,976 records.
Comment 3 Xiaoying Gu CLA 2011-03-17 02:45:04 EDT
Tomcat JVM setting: JAVA_OPTS="-server -Xmx512m -Xms128m -XX:MaxPermSize=512m"

set as worksforme.
Comment 4 Xiaoying Gu CLA 2011-03-18 04:48:02 EDT
reopen for further check if  there are too many CSSValue object.
Comment 5 Jun Ouyang CLA 2011-04-15 04:35:20 EDT
Could you please attach the report design and the report document generated by the design?
Comment 6 Jun Ouyang CLA 2011-05-10 04:59:33 EDT
Not reproducible on latest build.

According to memory dump, a table more than 70000 rows and 25 columns could be rendered with 1GB memory, in which only 88m memory is occupied by 358 CSSValue instances.

Rendering a table with 12500 rows * 25 columns only costs less than 400m memory on 64bit machine and 200m on 32bit machine.