Description :
We are experiencing a significant issue with high memory utilization when performing document comparisons using Aspose.Words. The memory usage spikes to 15-16 GB, causing the process to stall. This occurs specifically when comparing two documents, each containing 150-200 pages with numerous changes.
Aspose version:22.4.0
Code Example :
public Document Compare(Document original, Document modified)
{
// Accept all revisions in both documents
original.AcceptAllRevisions();
modified.AcceptAllRevisions();
// Compare the documents and store the changes in the original document
original.Compare(modified, Author, DateTime.Now, compareOptions);
return original;
}
Steps to Reproduce:
- Create a document comparison scenario with two documents, each containing 150-200 pages and numerous changes.
- Call the
Compare
method as shown in the code example. - Observe the memory utilization during the comparison process.
Observations:
- The memory usage reaches 15-16 GB when performing the compare operation.
- Removing the compare line significantly reduces memory usage to around 500-600 MB.
- Adding the following comparison options reduces memory usage to 10-12 GB but does not resolve the issue entirely:
new CompareOptions
{
IgnoreFormatting = true,
IgnoreCaseChanges = true,
IgnoreComments = true,
IgnoreTables = true,
IgnoreFields = true,
IgnoreFootnotes = true,
IgnoreTextboxes = true,
IgnoreHeadersAndFooters = true
};
Request :
Need assistance in optimizing the memory usage during the document comparison process. Any guidance on reducing memory consumption or alternative approaches to handle large documents with numerous changes would be highly appreciated.