Aspose Words out of memory

We are using Aspose.words (version 16.1) to edit word documents and generate a PDF copy of the changed document. The changes include replacing a specific text (Marker) in the document with an image and replacing a placeholder image in document with a signature image.
In case of a large document, the process of editing document fails with an OutOfMemoryException.
The sample code attached contains the website which could demonstrate the issue. All required content is inside a folder called “TempFolderContents”, this includes sample word document and sample image file which gets inserted in word document.
A “Read Me.txt” file provides the steps in more details to reproduce the error. Aspose.words version 16.1 dll is also included inside SupportFiles folder.
We would be grateful if you could advise if anything can be done to avoid the out of memory exception - there is plenty of memory on the server which isn’t being used and we regularly need to process documents with many thousands of pages.
Thanks,
Ross

Hi Ross,

Thanks for your inquiry. After an initial test with Aspose.Words for .NET 16.3.0, I was unable to reproduce this issue on my side. I would suggest you please upgrade to the latest version of Aspose.Words. You can download it from the following link. I hope, this helps.
https://releases.aspose.com/words/net/

Best regards,