OutOfMemoryException - Aspose.Words for .NET 9.1.0.0

Hello,

We are having OutOfMemoryException while opening 19Mb doc file and trying to save it as docx. Task manager shows spike in memory of 1.3Gb and then application crashes. I saw earlier posts on similar subject and just want to know if it still unresolved.

System.OutOfMemoryException was caught

Message="Exception of type 'System.OutOfMemoryException' was thrown."

Source="mscorlib"

StackTrace:

at System.IO.MemoryStream.set_Capacity(Int32 value)

at System.IO.MemoryStream.EnsureCapacity(Int32 value)

at System.IO.MemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count)

at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)

at System.IO.StreamWriter.Write(String value)

at System.Xml.XmlTextWriter.InternalWriteEndElement(Boolean longFormat)

at System.Xml.XmlTextWriter.WriteEndElement()

at ׎.㇗.㇠(String ㇟)

at ㆾ.ㇴ.VisitParagraphEnd(Paragraph para)

at Aspose.Words.Paragraph.Accept(DocumentVisitor visitor)

at Aspose.Words.CompositeNode.ᗐ(DocumentVisitor ڛ)

at Aspose.Words.Body.Accept(DocumentVisitor visitor)

at ㆾ.ㇴ.㈗(CompositeNode ㈘)

at ㆾ.㇯.㇆()

at ㆾ.㇯.DoWrite()

at ㆾ.ㇴ.ٹ()

at ㆾ.ㆽ.㇆()

at ㆾ.ㆽ.⣓(⢚ ⢙)

at Aspose.Words.Document.ᖚ(Stream ֲ, String ֺ, SaveFormat ᖛ)

at Aspose.Words.Document.Save(String fileName, SaveFormat fileFormat)

at Aspose.Words.Document.Save(String fileName)

at CJLRDLogic.OpenXMLDocument.DocumentHandler2.GenerateSegmentedPDFs(String directory, String guid, String docName) in C:\Development\CJLRD\CJLRDLogic\OpenXMLDocument\DocumentHandler2.cs:line 79

at CJLRDLogic.OpenXMLDocument.DocumentHandler2.ProcessAgreement(String dir, String fileNameWord, String guid, String& PdfCopyName, List`1& documentSegments) in C:\Development\CJLRD\CJLRDLogic\OpenXMLDocument\DocumentHandler2.cs:line 54

InnerException:

Thanks,
oleg

Hello

Thanks for your request. Could you please attach your input document here for testing? I will check the problem on my side and provide you more information.

Best regards,

Due to semi-sensitive nature of the document can you give me email address where I can send it .
oleg

Hi Oleg,

Thank you for additional information. I received your document; I will check it and provide you more information.

Best regards,

Hi Oleg,

Your document contains > 80 EMF metafiles. They are stored compressed inside the DOC file, but when Aspose.Words reads the document into memory it uncompresses them. Some of these metafiles are really big. Total size of all of your uncompressed metafiles is > 1000 MB.

Aspose.Words uncompresses them on loading into memory.

So the only way you can open this file if you add more RAM to your machine. Aspose.Words will take loads of memory when loading the document, but when you finished processing the document, all memory will be released and garbage collected quickly. So it will be only a short spike of high memory use.

Best regards,

The issues you have found earlier (filed as WORDSNET-3449) have been fixed in this Aspose.Words for .NET 21.4 update and this Aspose.Words for Java 21.4 update.