Jump to content
Changes to the Jaspersoft community edition download ×

OutOfMemory when Filling/Exporting


Recommended Posts

I have in place a Reporting FrameWork based around JasperReports.


See the blog:



As discussed significant memory issues occur when dealing with large SQL results.


I have tried Virtualisation and hacked around with the code using Files instead of inmemory objects for the jasper objects. No luck.


As stated I am in a race against a bunch of Crystal Reports developers. The framework wins hands down, but if I can't solve this memory problems, then the client will kill my work and move to Crystal.


Are there any patches/fixes in place or coming up that address the huge memory burden when filling/exporting large reports. Note all the reports are just tables, ie, tabular representations of the results of the SQL ResultSet.




Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Some comments:


To take the results of the SQL and convert to a JRDataSource - 100MB.


Do you use a custom data source which fetches all the data from the result set and keeps it in memory? This should not be the case, since keeping an open result set and scrolling it while the engine pulls rows from the data source would require less heap space. This is how the default JRResultSetDataSource works; you can control the fetch chunk size using the net.sf.jasperreports.jdbc.fetch.size property.



I then used Virtualisation, this reduced the memory requirements for the Fill, but it made no impact to the export, I was still hitting around 720+MB.


Most of the exporters support output streaming, i.e. they should not accumulate memory while exporting a report to an external output stream. You mentioned that you removed all the uses of in-memory byte arrays, I this applies to export as well and you are not using in-memory output streams as export targets.


The HTML, PDF and CSV exporters should not require too much memory when exporting large reports to external output streams. If you find that this is not the case, we'll investigate it.


The XLS exporters, however, pose memory problems since they keep the entire worksheet in memory. This is a limitation of both the POI and JExcel libraries and I don't know what could do about it.



Also since virtualisation splits the jasperPrint object, I found this did not save to the database.


Serialization of virtualized report is supported since JR 1.2.3. The only drawback is that the size of the the serialized report is slightly bigger when the report is virtualized.




Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...