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

Free Support Forum - aspose.com

OutOfMemory Exception in Words


When building huge documents assume >4000 pages we are getting memory out of exception.

Our word generator is a 32-bit console application and due to some constraints we can't move to 64-bit.so we want to optimize the memory usage.

are there any tips or tricks that will make it work.

We are using the below code to save the document and the document has a TOC based on bookmarks not a normal word TOC.

Dim docxSaveOptions As Aspose.Words.Saving.OoxmlSaveOptions = New Aspose.Words.Saving.OoxmlSaveOptions(SaveFormat.Docx)

doc.Save(tfs, docxSaveOptions)

Please share anything that makes sense for this problem.


Hi Lalitya,

Thanks for your inquiry. Please note that CPU performance and memory usage all depend on complexity and size of the documents you are loading/generating.

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.

Please do not call Document.UpdatePageLayout method in your code as you are updating the fields and saving the document to Docx.

If you still face problem, please attach your input Word document and code example here for testing? We will investigate the issue on our side and provide you more information.