bob4apples Posted June 11, 2008 Share Posted June 11, 2008 I see lots of posts about the "java.lang.OutOfMemoryError: Java heap space" issue, and am running into it myself. I am using the virtualizer as suggested here: Code:http://www.jasperforge.org/jaspersoft/opensource/business_intelligence/jasperreports/faq.html#FAQ13 This is how I initalize it in my code (the numbers might be too high/low, but I'm playing with the buffer sizes etc. at the moment): Code:[code]JRSwapFileVirtualizer virtualizer = new JRSwapFileVirtualizer(4, new JRSwapFile(configLocation + "tmp/", 16384, 8192), true); Since I am running it through Apache Tomcat, I have also set the memory quite high: Code:[code]JAVA_OPTS="-Xms2048M -Xmx2048M"CATALINA_OPTS="-Xms2048M -Xmx2048M" I can create the report (> 2000 pages) in about 30 seconds, and can also export it to PDF in about the same amount of time (both of which are acceptable). My problem is that when I try to export it to either XLS or CSV -- then the out of memory error shows up. Here's the question -- is this because the virtualizer actually works on generated pages in the final document? I am using paging for the HTML and PDF reports, but when it comes to the XLS and CSV I ignore the pagination with: Code:[code]params.put("IS_IGNORE_PAGINATION", "true"«»); This essentially makes the report one giant page, right? Is that what is causing the out of memory issue? If so, is there a way around it? And if not, is there something else that I am missing? I'm kind of stumped here ... Thanks.Post edited by: bob4apples, at: 2008/06/10 20:24 Link to comment Share on other sites More sharing options...
lucianc Posted June 11, 2008 Share Posted June 11, 2008 bob4apples wrote:This essentially makes the report one giant page, right? Is that what is causing the out of memory issue? Yes. Virtualizations works by externalizing whole report pages to the file system. When a report is filled with pagination ignored, a single page is generated, and this page is kept in memory. The only workaround I can think of is to fill paginated reports, and filter the page footers and headers when exporting to CSV/XLS. Regards,Lucian Link to comment Share on other sites More sharing options...
bob4apples Posted June 13, 2008 Author Share Posted June 13, 2008 lucianc wrote:Virtualizations works by externalizing whole report pages to the file system. When a report is filled with pagination ignored, a single page is generated, and this page is kept in memory.The only workaround I can think of is to fill paginated reports, and filter the page footers and headers when exporting to CSV/XLS. Thanks for the suggestion, this worked for the most part. The CSV export is working fine now. The only issue I have is that the XLS export still throws that error for a report that is a little over 1800 (or so) pages. Would messing with the swap file virtualizer numbers make a difference? I've raised those to some pretty high values and it still doesn't seem to help. Thanks. Link to comment Share on other sites More sharing options...
lucianc Posted June 16, 2008 Share Posted June 16, 2008 bob4apples wrote:The only issue I have is that the XLS export still throws that error for a report that is a little over 1800 (or so) pages. The libraries that JasperReports uses to export to XLS (Apache POI or JExcelAPI, depending on which exporter you use) are not exactly scalable as they keep the entire document in memory (unlike other exporters such as the PDF or the HTML ones which stream the output document while it is being generated). The virtualizer only applies to the JasperPrint object, and cannot influence in any way the memory used by the XLS libraries. Regards,Lucian Link to comment Share on other sites More sharing options...
christiaan_se Posted June 16, 2008 Share Posted June 16, 2008 JExcelAPI has been made more memory-scalable in terms of writing Excel files. Starting from version 2.6.5 you can use useTemporaryFileDuringWrite. You probable need to subclass JExcelApiExporter in order to use this property. kind regards,Christiaan Link to comment Share on other sites More sharing options...
jenue Posted October 12, 2009 Share Posted October 12, 2009 i have the same issue also running a pdf report with over 200,000 of rows. any idea guys? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now