Use Aspose.PDF in Azure Website - excessive memory usage while saving large pdf files

Hi,

Memory usage is sometimes really high when saving pdf files with lot or pages and/or graphical contents. (aspose.pdf 20.11)

This is problematic for us as we’re using Aspose in an azure website and have seen Aspose go up to 1.3GB of ram usage for a single document (280 pages with a lot of shapes and pictures ~ 30mo) which led to an “out of memory exception” for the instance.
We’re using aspose to add a simple cover page to the document. We do not change the rest of the content.
Unfortunately I can’t send you the document that caused the issue. (it’s a confidential document)

Is there a way to improve memory efficiency ?

Note: this issue is a bit similar to Excessive amount of memory used or Out Of Memory Exception thrown when Extracting text from large PDFs

Have a nice day,

@ECHRLicences

We have been working over API performance and making it improved in every monthly release. However, there are some complex scenarios which take certain amount of time in order to get fully investigated and resolved due to their dependence upon various internal components of the API.

The ticket in the referenced thread is not yet resolved due to its complexity. However, we have linked it with your thread as well so that you can receive a notification too once it is resolved. Furthermore, it would be hard to determine the reason of the issue without replicating it in our environment which is why it is important if you could please share some sample PDF document with code snippet.

We assure you that we honor your confidentiality and files are used only for testing purposes. We do not disclose them with anyone and delete them from our system once the investigation is done.

Hi,

I will try to produce a sample pdf. I’ll go back to you.

@ECHRLicences

Sure, please take your time to collect a sample PDF and share it with us.

Hi,

I’ve generated a sample document. I had to split it in several files.
Just remove the last “.zip” extension for each file and unzip it (I’ve used 7zip)

I’ve also included a small piece of code to reproduce the issue. On my machine (i5 8500, 16GB) opening then saving this document takes 1 minute and half and use almost 1.4GB of ram.

aspose-save-pdf-excessive-memory.jpg (54.2 KB)

document-safe.zip.001.zip (5 MB)
document-safe.zip.002.zip (5 MB)
document-safe.zip.003.zip (4.1 MB)
ConsoleApp1.zip (1.2 KB)

Have a nice day

@ECHRLicences

We were able to reproduce the issue in our environment while testing the scenario with Aspose.PDF for .NET 20.12 and logged it as PDFNET-49176 in our issue tracking system. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

Hi,

Any news regarding this issue?

Best regards

@ECHRLicences

The issue has recently been logged in our issue tracking system and is pending for a review. We will investigate and resolve it on a first come first serve basis and let you know in this forum thread as soon as we have some updates in this regard. Please give us some time.

We are sorry for the inconvenience.