Update Fields uses too much memory with files containing many pages and form fields

Hello,

We ran into a serious issue in production with the the UpateFields feature. Sometimes our API dealing with Office documents stopped responding. We saw it occurred after processing a document containing a lot of form fields.
When trying to reproduce the issue in my debug environment, I saw that UpdateFields memory consumption were unusually high when UpdateFields was called for a document with 300 pages, a lot of form fields and a few custom quick parts. Memory used by the process went up to 1.3GB, that seems a lot for dealing with one single document with a size of 240KB.
Also the time taken by the UpdateFields method was very long, sometimes more than 10 minutes, and it caused timeouts in the calling application.

I searched for a way to update only a set of known fields, but could not find any. Is there any way to avoid calling UpdateFields for the whole document ?

Please find attached the dummy document I used for testing : m2-2_300p with SDT tags and quick parts.docx (239.2 KB)

Version : Aspose.Words 22.3

Thanks in advance for your answer,
Regards,

Julien

@JulienFaugier I wasn’t able to replicate your issue. When using the latest version of the Aspose.Words package, executing the UpdateFields() method took around 20 seconds (in average) to complete, and it did not significantly increase the amount of memory (RAM) used by the process. Therefore, I recommend that you update to the latest version of the API.

Furthermore, a very similar bug to yours was reported four months ago in this post and logged as WORDSNET-24888. It has already been resolved, and the fix was released in version v23.4.