Save fails with OOME

Hi Team,

When a word document is generated used AsposeWordForJava, we get OutOfMemoryError during save. The word document could have more than 10,000 pages within it. We’ve set max heap to 1.5GB, but that doesn’t help. I’m not aware of internal details the “save” API of come.aspose.Document. Is there a way to make sure that once the data is written from the document model keep release the memory or is it already doing that?

Any suggestions are helpful here.

Another query is, once it fails with OOME, whatever the document is written is available. Is this expected?

Thanks,
Kumar

Hi Kumar,

Thanks for your inquiry.

*kumaraswamy.m:

When a word document is generated used AsposeWordForJava, we get OutOfMemoryError during save. The word document could have more than 10,000 pages within it. We’ve set max heap to 1.5GB, but that doesn’t help. I’m not aware of internal details the “save” API of come.aspose.Document. Is there a way to make sure that once the data is written from the document model keep release the memory or is it already doing that?*

It would be great if you please share your input document along with code here for testing. I will investigate the issue on my side and provide you more information.

*kumaraswamy.m:

Another query is, once it fails with OOME, whatever the document is written is available. Is this expected?*

No, Document.Save method does not save the document partially. In case you are using an older version of Aspose.Words, I would suggest you please upgrade to the latest version (v13.9.0) from here:
https://releases.aspose.com/words/net

Hi Tahir,

>>> It would be great if you please share your input document along with code here for testing. I will investigate the issue on my side and provide you more information.
This would be highly impossible as the issue is happening at our customer site. But OOME on save have been reported before. Are there any tips on handling such scenarios like any setting so that the memory is released as and when required.

Thanks for the info on the partial save.

Thanks,
Kumar

Hi Kumar,

Thanks
for your inquiry. It is quite difficult to answer such questions
because CPU performance and memory usage all depend on complexity and
size of the documents you are loading/generating. Please increase heap size and test your scenario again.

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.

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

Hi Tahir,

>>> It is quite difficult to answer such questions
because CPU performance and memory usage all depend on complexity and
size of the documents you are loading/generating. Please increase heap size and test your scenario again.

We already tried this. Since we use 32-bit JVM, the max heap size that we could set is 1.5GB. Even with this, we see OOME.

Creating a replicable test case might not be feasible case. Let this be on hold for now. I’ll reach out again when required.

Thanks,
Kumar

Hi Kumar,

Thanks
for your feedback. Please let us know once you have document and code on this issue. We will then provide you more information on this issue.

Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.