java.lang.OutOfMemoryError converting from DOCX to PDF

Hi all, I’m converting a docx file to PDF, but it throws a java.lang.OutOfMemoryError in the line:

com.aspose.words.Document document = new com.aspose.words.Document( <FILE_PATH> );

The complete code is:

com.aspose.words.Document document = new com.aspose.words.Document( <FILE_PATH> );
FontSettings.setFontsFolder(this.getFontsPath(), true);
document.save(storeUrl.toString());

The file is in Dropbox:
https://www.dropbox.com/s/d40m6gk32d07hjn/55ddb239-c877-4cb0-a5d6-4c5e71d40d09.docx?dl=0

Our version is Aspose.Word 14.11.0 jdk 16.

I need to solve this problem soon, please, let me know any news.

Best Regards.
Martin Fernandez
Senior Java Developer

Hi Martin,

Thanks for your inquiry.

Sometimes Aspose.Words for Java will throw OutOfMemoryError on Java. This is because the default Java heap space might not be enough for high memory spikes when processing some documents. In this case, the easy way to workaround is to increase the heap space for the JVM.

I hope, this helps.

Best regards,

Hi, I increased heap values for 512mb and it worked, but I need to leave the original heap values (-Xms512m -Xmx1024m).

We have a similar problem with the post:
https://forum.aspose.com/t/48428

There is an open issue (WORDSNET-11101).

I would appreciate if you could help me.

Best Regards
Martin Fernandez
Senior Java Developer

Hi,
as I said to them, increasing the heap values could perform the conversion properly.

Here I attached an image with a fragment of the information of the heap dump created when the conversion was successful.

Best Regards
Martin Fernandez
Senior Java Developer

Hi,

I just convert the DOCX file to PDF file using this site --> http://convertonlinefree.com/

Apparently, the problem is in the Aspose component that it possibly instantiating many objects and leaves no space in the heap memory.

Please, I need help with this subject.

Best Regards.
Martin Fernandez
Senior Java Developer

Hi Martin,

Thanks for your inquiry. The fix of WORDSNET-11101 has been included in Aspose.Words 14.12.0. Please download the latest version from the following link:
https://releases.aspose.com/words/java

Please upgrade to the latest version and see how it goes on your end. I hope, this helps.

Best regards,

Thank you Awais, that issue was solved with the new version 14.12.0 (Problem converting a big word file to PDF (62mb)).

But, I still have this issue open, because made testing with the new version and the exception OutOfMemoryError continues.

Best Regards
Martin Fernandez
Senior Java Developer

Hi Martin,

Martin:
Apparently, the problem is in the Aspose component that it possibly instantiating many objects and leaves no space in the heap memory.

To ensure a timely and accurate response, please create a standalone runnable simple Java application that helps us reproduce your problem on our end and attach it here for testing. As soon as you get this simple application ready, we’ll start investigation into your issue and provide you more information. Please tell us the details of the development environment e.g. OS (Windows Version or Linux Version) and it’s architecture (32/64 bit) of the machine you’re getting this problem on during rendering DOCX to PDF.

Best regards,

Hi Awais, the test in a standalone projec was succesfull.

After many test, we decided to increase to 256 mb the max java heap (1gb + 256mb) and the conversion was ok.

You could close this issue.

Thank you a lot for your help.

Martin Fernandez
Senior Java Developer

Hi Martin,

Thanks for your inquiry. It is great you were able to find what you were looking for. Please let us know any time you have any further queries.

Best regards,