I have a process that opens a word doc, does some font spacing clean up, adds a TOC field, updates all fields and saves. I am getting a System.OutOfMemoryException when I save the doc. The doc is somewhat large (8-9 MB, ~1400 pages). I have enabled Memory Optimization in the save settings. I scaled the processing back to just open the doc and save it and I still see the exception. The failure is happening on a server that has 18GB of memory. When I monitor memory usage, peek usage never goes above 50%. When I run this standalone on my development laptop (32GB memory) the process works. We are running with the latest version 22.1
This is the code I am running.
License license = new License(); license.SetLicense(asposeLicense); Document sourceDoc = new Document(targetWord); var theSaveOptions = Aspose.Words.Saving.SaveOptions.CreateSaveOptions(targetWord); theSaveOptions.MemoryOptimization = true; theSaveOptions.SaveFormat = SaveFormat.Docx; logMessage(interactive, context, EventLevel.Verbose, DetailStatus.Success, eventAction, "Before Save After Open"); sourceDoc.Save(targetWord, theSaveOptions); logMessage(interactive, context, EventLevel.Verbose, DetailStatus.Success, eventAction, "After Save After Open");