OutOfMemoryError while generating pdf report

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Generator for Java (v4)  /  OutOfMemoryError while generating pdf report

DynamicPDF Generator for Java (v4) Forum

Hi,

My application runs in Sun OS with websphere as the application server. We are using DynamicPDF.jar for generation of pdf reports. The average pdf report generation size is around 200 - 300 KB. There are around 200-250 report generations per day. We are getting OutOfMemoryError frequently in the recent times causing the server to go down. Following is the description of the error:

[9/23/10 11:12:00:317 BST] 00000cea SystemErr     R Exception in thread "Thread-1803" java.lang.OutOfMemoryError
        at java.util.zip.Deflater.init(Native Method)
        at java.util.zip.Deflater.<init>(Deflater.java:117)
        at java.util.zip.Deflater.<init>(Deflater.java:134)
        at com.cete.dynamicpdf.imaging.GifImageData.a(Unknown Source)
        at com.cete.dynamicpdf.imaging.GifImageData.a(Unknown Source)
        at com.cete.dynamicpdf.imaging.GifImageData.<init>(Unknown Source)
        at com.cete.dynamicpdf.imaging.ImageData.getImage(Unknown Source)
        at com.cete.dynamicpdf.pageelements.Image.<init>(Unknown Source)
        
Can you please help me to provide a fix for this issue.
Posted by a ceTe Software moderator
Hello

We are able to generate very large PDF documents using our product without any problem. We have generated 300MB and more sized PDFs without any problem.

A possible problem with the OutOfMemoryError could be that you are running out of Virtual Memory. Try increasing the Maximum heap size value and running the application again and see if you still get the error. Following is the command line syntax to increase the Virtual Memory size: java -Xms512m -Xmx512m <javaclassname>.

As a general rule, set minimum heap size (-Xms) equal to the maximum heap size (-Xmx) to minimize garbage collections.



Thanks,
ceTe Software Support Team
Hi,

Thanks for the reply.
Currently we have 1024 MB space.
Do we need to have more than this?
Posted by a ceTe Software moderator
Hello,

Seems like you have enough memory. Can you please try to enabling the incremental gc using -Xincgc?
If that does not work, please try calling the System.runFinalization() method after the call to Draw method, this should free up any pending resources that need to be garbage collected.

If both solutions do not work, please send the code that you are using to Support Team so that we can try to recreate it on our end.

Thanks,
ceTe Software Support Team

All times are US Eastern Standard time. The time now is 1:51 PM.