Jump to content
We've recently updated our Privacy Statement, available here ×

Yet another "OutOfMemoryError: Java heap spac


bob4apples

Recommended Posts

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

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

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

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

  • 1 year later...

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...