Eclipse BIRT is a very commonly used platform for generating many kind of reports. It provides core reporting features such as report layout, data access and scripting. Specially, its report layout editor combined with native eclipse extensions such as WTP makes it a powerful tool for designing and generating email based news letter.
I manage last weeks to use this platform for generating such a news letter for Trailplans – a free application for discovering and sharing walks, bike or urban trails through points of interest – and come to some limitations and – more interesting – some workarounds that I found it’d be interesting to share.
Report Engine is greedy !
The Report Engine section of BIRT documentation mentions a sample on how to cleanly initialize/finalize BIRT engine. Applying this sample allows you to quickly run out and generate a report. Nice.
However, here’s a fact : when it comes to use this sample for generating dozens of reports in a loop, the memory used by BIRT grows till the saturation of the JVM HeapSize, ending out with a beautiful OutOfMemoryError.
My setup : BIRT 2.6.1 and JDK 1.6.
A workaround
A simple trick – but maybe not so obvious because not mentionned on any BIRT related forum – is to cache the BIRT engine loaded artifacts that are the EngineConfig
, IReportEngine
and the IReportRunnable
. To do that, just use a static initialization block into your launching class containing your main()
method.
Find the end of the article and comments here : http://lbroudoux.wordpress.com/2011/03/06/limit-birt-heap-usage-to-avoid-outofmemoryerror/
Let me know if it has been helpful.