Memory optimizations and Load/Save options

Hi,

I wanted to ask if there are any memory optimizations which can be configured while loading and working with large documents. In Aspose.Slides you can allow temporary files and max bytes via BlobManagamentOptions while loading. In Aspose.Cells you also have a MemorySetting property in the LoadOptions. Is there anything similar for Aspose.Words? It is ok if this may reduce performance.

I also noticed there are properties (MemoryOptimization and TempFolder) in the SaveOptions. However, you have to use a different SaveOption class depending on the save format. Regarding the ´DocSaveOptions` there is written in the documentation:

Can be used to specify additional options when saving a document into the Doc or Dot format.

So it is not possible to use this with docx format, is this correct or can we still use it even it is not documented?

@Serraniel

You can use OoxmlSaveOptions.MemoryOptimization property with DOCX file format. You can also use SaveOptions.TempFolder property with DOC or DOCX file formats.

Could you please share some detail about the issue that you are facing while using Aspose.Words? We will then provide you more information about your query.

Hi Tahir,

thanks for your reply, I will impement that for docx then.

Could you please share some detail about the issue that you are facing while using Aspose.Words? We will then provide you more information about your query.

We have the issue that we sometimes get and OutOfMemoryException with some documents (the scenario is rare and the same for Aspose.Words, Aspose.Slides and Aspose.Cells). The reason for this is, that our product is a win32 application made with Delphi. From that application we host .net framework via Crosstalk to use .Net libraries (as it is explained in this older topic: Issue with Aspose Memory Usage). The result is, that the .Net Framework is behaving as it would run on a 32bit system and shares memory with our application, so we are limited to ~2GB. We are currently testing to double that amount (on x64 system) with setting the IMAGE_FILE_LARGE_ADDRESS_AWARE image header flag for our application. This fixes the memory problems with the customer documents we know made issues before, but we are not sure yet if there are any side effects with the above flag and other packages and libraries we use. So, as we do not know yet if this soloution will work for us and it just shifts the issue to ~4GB of memory we are trying to reduce memory usage as much as possible.

I am aware that issue mostly exits because of our architecture and how we use Aspose via Delphi but we are trying to reduce the problems for our customers as much as possible.

Kind Regards,
Daniel

@Serraniel

We have added a new feature as WORDSNET-18827 in our issue tracking system to perform memory optimization while loading Word document. You will be notified via this forum thread once this feature is available.

We apologize for your inconvenience.

@Serraniel

Could you please attach your input Word document for which you are facing the issue? We will investigate the issue on our side and provide you more information.

Hi,

I have uploaded you a zip archive to our FTP as the archive is too large for the forum. save01 and save02 are documents which had issues in the past during saving as docx but are solved with the mentioned fixes.
The other doc document also works with our mentioned changes but had huge issues when opening the document before. However I am not allowed to upload the original document so I had to reduce it by content (file size of original .doc file is 344 MB). It originally contains many jpeg images which are above 10 MB in size and a few EMF images which have a small file size but may need much memory. At least that´s what a staff member said last year in relation to WORDSNET-17623:

Yes, the analysis of this issue is completed. Actually the source document is in DOCX format and it contains several very big EMF pictures with 200 Mb total size. EMF pictures have good compression rate that is why the DOCX has relatively small size. One solution we are thinking about is to try to hold the images compressed in memory and unpack on demand. We will inform you via this thread as soon as this issue is resolved. We apologize for any inconvenience.

Please let me know as soon as you downloaded the files, so I can delete them from our FTP.

Kind Regards and thanks for your support,
Daniel

Media from original document:
image.png (15.4 KB)

Download:
download.zip (204 Bytes)

@Serraniel

Thanks for sharing the documents. We will inform you via this forum thread once there is an update available on this issue. You can delete the files from FTP.

The issues you have found earlier have been fixed in this Aspose.Words for .NET 20.12 update and this Aspose.Words for Java 20.12 update.