We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

OutOfMemory while saving doc to pdf

Hi,

normally converting doc files to pdf works really fine!

Unfortunateley we have a problem with converting a specific doc file to pdf (see attachment).Saving as pdf results in an OutOfMemoryException. I have tested this problem with latest version 16.11.0 of Aspose Word for Java.

Stacktrace
Exception in thread “Image Fetcher 0” java.lang.OutOfMemoryError: Java heap space

Thanks a lot
Best regards
Matthias
Hi Matthias,

Thanks for your inquiry. We have tested the scenario at Windows 7, Jdk 1.8 using latest version of Aspose.Words for Java 16.11.0 with VM options -Xmx1024m and have not found the shared issue. Please increase the heap size at your side to fix this issue. Moreover, please make sure that you are using Aspose.Words for Java 16.11.0 and same input document.

Please let us know if you have any more queries.

Hi Tahir,


ok, it works for me too, if VM memory options is set to -Xmx350m. Using -Xmx300m fails.

Main question: Is it possible to reduce the memory usage?

Our customers are not able and often are not ready to increase memory on their client applications.
It is striking that converting this doc file to pdf needs more than 300MB althogh the file size is only about 3MB.
For me, it seems to be a bug (especially for this file) because we do not have these memory problems with other doc files.

Thanks a lot
Best regards
Matthias

Hi Matthias,

Thanks for your inquiry. Please note that performance and memory usage all depend on complexity and size of the documents you are generating. While rendering a document to fixed page formats (e.g. PDF), Aspose.Words needs to build two model in the memory – one for document and the other for rendered document.

In terms of memory, Aspose.Words does not have any limitations. If you're 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.

We're always working on improving performance; but, rendering will be always running slower than simple saving to flow formats (e.g. doc/docx).