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

Out of memory error during filling sub report


gayachalam

Recommended Posts

Hi,

 

I'm getting out of memory error while filling a subreport. Following is the stack trace I get.

 

 

net.sf.jasperreports.engine.JRException

at net.sf.jasperreports.engine.fill.JRFillSubreport.prepare(JRFillSubreport.java(Compiled Code))

at net.sf.jasperreports.engine.fill.JRFillBand.prepareElements(JRFillBand.java(Compiled Code))

at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java(Compiled Code))

at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java(Inlined Compiled Code))

at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java(Compiled Code))

at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillGroupFooter(JRVerticalFiller.java(Inlined Compiled Code))

at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillGroupFooters(JRVerticalFiller.java(Inlined Compiled Code))

at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportContent(JRVerticalFiller.java(Inlined Compiled Code))

at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java(Compiled Code))

at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java(Compiled Code))

at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java(Compiled Code))

at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:76)

at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:247)

at com.taxware.twe.report.ConnectionReportGenerator.generateTempReportFromQuery(ConnectionReportGenerator.java:588)

... 12 more

Caused by: java.lang.OutOfMemoryError

at java.text.RuleBasedBreakIterator$Builder.buildCharCategories(RuleBasedBreakIterator.java(Compiled Code))

at java.text.RuleBasedBreakIterator$Builder.buildBreakIterator(RuleBasedBreakIterator.java:895)

at java.text.RuleBasedBreakIterator.<init>(RuleBasedBreakIterator.java:284)

at java.text.BreakIterator.createBreakInstance(BreakIterator.java:537)

at java.text.BreakIterator.getBreakInstance(BreakIterator.java(Inlined Compiled Code))

at java.text.BreakIterator.getLineInstance(BreakIterator.java(Inlined Compiled Code))

at java.text.BreakIterator.getLineInstance(BreakIterator.java(Inlined Compiled Code))

at java.awt.font.LineBreakMeasurer.<init>(LineBreakMeasurer.java(Inlined Compiled Code))

at net.sf.jasperreports.engine.fill.TextMeasurer.renderParagraph(TextMeasurer.java(Compiled Code))

at net.sf.jasperreports.engine.fill.TextMeasurer.measure(TextMeasurer.java(Compiled Code))

at net.sf.jasperreports.engine.fill.JRFillTextElement.chopTextElement(JRFillTextElement.java(Compiled Code))

at net.sf.jasperreports.engine.fill.JRFillTextField.prepare(JRFillTextField.java(Compiled Code))

at net.sf.jasperreports.engine.fill.JRFillBand.prepareElements(JRFillBand.java(Compiled Code))

at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java(Compiled Code))

at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java(Inlined Compiled Code))

at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java(Compiled Code))

at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnHeader(JRVerticalFiller.java(Compiled Code))

at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java(Compiled Code))

at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java(Compiled Code))

at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java(Compiled Code))

at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java(Compiled Code))

at net.sf.jasperreports.engine.fill.JRFillSubreport.run(JRFillSubreport.java(Compiled Code))

 

 

I'm using Jasper-0.6.7. I'm using the connection object to get the data from my database. The JDK used is Java 1.4.2_08.

 

 

I'm getting the same out of memory issue even if I upgrade to Jasper-1.2.5. The out of memory error comes while getting the Jasper print object. Also the out of memrory issue comes only when I use the sub report in my Jasper. If the sub report is not used for the same number of records I'm able to generate the report. Unfortunately I've to use sub report as my requirement demands it. The sub report is in a group footer.I'm using a maximum heap of 1024M (1 GB). The number of records I'm trying to display 143,954 records. The sub report is executed 22,893 times as the sub report is in a group footer.

 

 

I'm getting this error only when I've more number of records to display in the report.

 

 

Is there any known issue with Jasper when the number of records grow beyond a threashold limit? I'm struck with this issue. Any help is greatly appreciated.

 

Thanks & Regards,

Arunachalam

 

Post edited by: gayachalam, at: 2006/09/06 03:54

Post edited by: gayachalam, at: 2006/09/06 05:30

Link to comment
Share on other sites

  • Replies 9
  • Created
  • Last Reply

Top Posters In This Topic

By default, JR keeps the whole generated report in memory. If the generated report is very large, this will obviously lead to memory exhaustion.

 

Report virtualization has been introduced in JR 1.0.0 to support large report generation (by avoiding to keep the whole generated report in memory). You should consider using a report virtualizer.

 

HTH,

Lucian

Link to comment
Share on other sites

Another option is to increase the size of your jvm.

 

When you start your jvm, pass it these flags:

-Xms128m -Xmx256m

 

The first tells it how much mentioned to initially grab. The second tells the jvm how large it can grow to. You can change the numbers (128, 256) to what ever numbers you wish.

 

Also I would only recommend doing this after you have tried the virtualization method mentioned by lucianc.

 

Hope this helps,

Duffek

Link to comment
Share on other sites

You can always check the samples that are provided with JasperReports. They are always a good idea of how to solve many problems.

 

Here is the code from the Virtualizer example

 

Code:
Map parameters = new HashMap();

parameters.put(JRParameter.REPORT_VIRTUALIZER, virtualizer);

JasperPrint jasperPrint = JasperFillManager.fillReport(fileName, parameters, dataSource);

virtualizer.setReadOnly(true);
Link to comment
Share on other sites

Hi,

 

Thanks a lot for the suggestions.

 

1) The out of memory trace clearly shows that the OoM is thrown whiling filling the sub report. I guess the Jasper went on an infinite loop. Possible reasons could be

a) The sub report is placed at the end of the page. Actually the sub report is given in the outer most group's footer. This is my business requirement.

b) The sub report I used has margins.

2)I removed the margins in the sub report and tried to generate the report. Now I'm able to generate the report for the specified number of records.

3) Then I tried to generate report 1.4 million records with the sub report being executed for 143,000 times. My memory settings was 1 GB. I ran through a standalone java class.

4) After 22 hours I got an out of memory error. But this time I didn't get any trace. Just one line "Out of Memory error".

5) I upgraded my reports to Jasper 1.5 and used the vitualizer.

6) Even after using the virtualizer, constructed with 5000 pages, I'm getting an out of memory error after 22 hours. This time also I had the memory of 1 GB.

 

I guess this time the issue could be with the large size of the Jasper Print object which will be loaded into the memory.

 

Is there any limitation about the size of the print object?

 

Thanks & Regards,

Arun.

Link to comment
Share on other sites

I've notice that behavior with my code as well. The virtualizer will reduce the size in memory of the JasperPrint, so I don't think that is your problem.

 

I've had stuff run 24 hours then stop because of memory errors. It was always because my data set was too large. So I wrote a method to split my data into smaller segments, and ran those smallers segments through JasperReports instead of a larger data set. I got a huge performance boost so doing this. So I would recommend doing some data management before processing the report.

 

Good Luck,

Dduffek

Link to comment
Share on other sites

1.4 million times, and you are surprised you are getting out of memory errors?

you are seriously going to have to split your data set down.

not to mention random crashes that occur now & again, do you really want to run such a report from the start?

 

I would get a couple of computers on the job. possibly serialising each page out to a common disk area, for either:

 

1. a 3rd computer to compile & print

2. compillation at end & split print form 2 machines

3. separate thread to print each page as it has finished serialising.

 

note , above would depend on if you were running a summary , also keep in mind that if you are doing such things as

 

page n of X, such detail can only be completed at the end of the report, you may need to have a re-think on your report format.

Link to comment
Share on other sites

  • 1 month later...

me too get a out of memory exception when my subreport have margin..

 

but i am really doubt why this behaviour is not consistent..

 

cause i first tried used a sub report with margin..

 

it work...

 

but when i create another report using subreport..it was giving me out of memory exception..

 

this was so weird..

Link to comment
Share on other sites

Hi,

 

Infinite loops like that occur because the subreport will never fit into the master report. This is probably caused by the fact that the master report has some margins (thus less available space for the subreport to expand) and the subreport wants to use the whole page size at some point (it has large bands that cannot split probably).

 

Overall document layout should be revised in such cases as there is definetely some inconsistency that causes the engine to enter an infinite loop trying to create new pages.

 

I hope this helps.

Teodor

Post edited by: teodord, at: 2007/05/04 11:02

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