OutOfMemory issues after upgrade

Hello,

after we upgraded aspose
from: aspose-pdf-kit-4.3.0.jar, Aspose.Words 4.0.2.0
to: aspose.pdf-new-4.1.2.jar, Aspose.Words for Java 13.6.0.0

we start having "OutOfMemoryError: GC overhead limit exceeded"
we were able to increase heap memory on JVM by 200mb and that didn’t help.

we are mostly using word to pdf conversion, merging multiple files together and Mail Merge.

Does new version use much more memory then the old one?


Hi Simon,


Thanks for contacting support.

Can you please share some further details regarding the scenario in which you are using the components. Either you are getting exception while converting Word files to PDF format or the problem is occurring when merging multiple files. Also please share the resource files so that we can test the scenario at our end.

We apologize for your inconvenience.

Hi Simon,


Thanks for your inquiry. Could you please attach your input Word documents here for testing?

Please also share some more detail about merging multiple files and Mail Merge. As soon as you get these pieces of information to us we’ll start our investigation into your issue.

Hi Nayyer,


I don’t have a straight answer to your question. There is no a particular piece of code that causing this. We have ~200 users in our system, OutOfMemory happens when they start using aspose features. Merging multiple files used most often.

Thank you

Hi Tahir,


it’s an OutOfMemoryError, there is no any particular document that causing this. It happens when user start using aspose features, mostly merging documents together.

Hi Simon,


Thanks for your feedback. I have tested the scenario and have not found the shared issue while using latest version of Aspose.Words for Java 13.7.0. Please download the latest version of Aspose.Words v13.7.0 from here:
http://www.aspose.com/community/files/72/java-components/aspose.words-for-java/entry487067.aspx

I suggest you please increase the heap size to 500 MB and test your scenario and let us know about your findings.

In terms of memory, If you are loading huge Word documents into Aspose.Words’ DOM, more memory would be required. This is because during processing, the document needs to be held wholly in memory. Usually, Aspose.Words needs 10 times more memory than the original document size to build a DOM in the memory. It is better to use few small documents instead of one huge document.

If you still face problem, please share some more detail about your complete scenario along with following details.

What environment are you running on?
  • OS (Windows Version or Linux Version)
  • Architecture (32 / 64 bit)
  • Java version
  • Provide information about your specific culture, such as the name of the culture, language and country/region.
  • Please supply us with the code from your application that is causing the issue
  • Please supply us with the input document that is causing the issue

As soon as you get these pieces of information to us we’ll start our investigation into your issue.


ENTITLEDIRECT:
I don’t have a straight answer to your question. There is no a particular piece of code that causing this. We have ~200 users in our system, OutOfMemory happens when they start using aspose features. Merging multiple files used most often.
Hi Simon,

Until or unless we are able to test this scenario and replicate it in our environment, I am afraid we might not be able to figure out the actual reasons of this issue. Furthermore, you are performing DOC to PDF and PDF merging operations so currently its not certain that which operation is failing. We are sorry for this inconvenience.

I rolled back to aspose-pdf-kit-4.3.0.jar and the memory issue is gone. So I’m sure that that issue is with concatenating multiple files in aspose.pdf-new-4.1.2.jar


Same code work fine with old jar, and give OutOfMemoryError with new jar, when users start using this feature in the morning

here is how we use it:
PdfFileEditor outfile = new PdfFileEditor();
ArrayList instreams = new ArrayList();
for (String id : documentsToProccess) {
Document d = new Document(filename);
ByteArrayOutputStream tmpBuffer = new ByteArrayOutputStream();
d.save(tmpBuffer,SaveFormat.PDF);
instreams.add(new ByteArrayInputStream(tmpBuffer.toByteArray()));
}
InputStream streams[] = new InputStream[instreams.size()];
instreams.toArray(streams);
outfile.concatenate(streams, outbuffer);

ENTITLEDIRECT:
I rolled back to aspose-pdf-kit-4.3.0.jar and the memory issue is gone. So I'm sure that that issue is with concatenating multiple files in aspose.pdf-new-4.1.2.jar

Same code work fine with old jar, and give OutOfMemoryError with new jar, when users start using this feature in the morning

here is how we use it:
....
PdfFileEditor outfile = new PdfFileEditor();
ArrayList instreams = new ArrayList();
for (String id : documentsToProccess) {
...
Document d = new Document(filename);
ByteArrayOutputStream tmpBuffer = new ByteArrayOutputStream();
d.save(tmpBuffer,SaveFormat.PDF);
instreams.add(new ByteArrayInputStream(tmpBuffer.toByteArray()));
}
InputStream streams[] = new InputStream[instreams.size()];
instreams.toArray(streams);
outfile.concatenate(streams, outbuffer);
....
Hi Simon,

Are you facing problem with specific PDF files or its occurring for all files when using Aspose.Pdf for Java 4.1.2. In case its related to specific files, please share the documents so that we can test the scenario at our end. Furthermore, can you please confirm if above stated Document object is from Aspose.Pdf or Aspose.Words as I am afraid I am unable to find PDF value from SaveFormat enumeration in Aspose.Pdf for Java.

We apologize for this inconvenience,

Hi Simon,


Thanks for inquiry. You are using Aspose.Words to and Aspose.Pdf in your code. The shared code shows that you are converting MS Word document to Pdf by using Aspose.Words and merging the Pdf files by using Aspose.Pdf.

Unfortunately, it is difficult to say what the problem is without the documents. Please create a simple test application that helps us reproduce the same problem on our end and attach it here for testing. We need your document(s) and simple test application to reproduce the problem. As soon as you get these pieces of information to us we’ll start our investigation into your issue.

The problem is that when we try to use new pdf JAR (please refer to previous posts for exact version), this code eventually cause OutOfMemoryError, it usually takes an hour in the morning when users start actually using the system , which imho suggests either memory leak or loading to many data into the memory.

Hi Simon,


Thanks for your patience.

I have tried replicating the issue using following code snippet and I am unable to notice any problem.

[Java]

com.aspose.pdf.facades.PdfFileEditor outfile = new com.aspose.pdf.facades.PdfFileEditor();<o:p></o:p>

ArrayList instreams = new ArrayList();

// specify the folder from which DOC files will be retrieved

java.io.File folder = new java.io.File("C:\\pdftest\\Giflogos\\");

// get the list of files present in particualr folder

java.io.File[] listOfFiles = folder.listFiles();

// itterate through each doc file

for (java.io.File file : listOfFiles) {

// print doc file name being processed

System.out.println(file);

com.aspose.words.Document d = new com.aspose.words.Document(file.getAbsolutePath());

ByteArrayOutputStream tmpBuffer = new ByteArrayOutputStream();

d.save(tmpBuffer,com.aspose.words.SaveFormat.PDF);

instreams.add(new ByteArrayInputStream(tmpBuffer.toByteArray()));

}

InputStream streams[] = new InputStream[instreams.size()];

instreams.toArray(streams);

outfile.concatenate(streams, new ByteArrayOutputStream());