We need to test this scenario in our environment in order to determine the root cause of the issue. Could you please share the final PDF document that you obtained after joining different files? We will try to compress it using shared code snippet in our environment and share our feedback with you. In case the PDF file size is larger, you can upload it to Google Drive or Dropbox and share the link with us.
We are sorry for the trouble. Would you please share the code snippet as well that you used to perform a separate test? We need to exact the same code snippet to test the scenario at our end so that we can try to observe similar results that you are noticing and address the issue accordingly.
We were able to notice the issue in our environment and have logged it as PDFNET-50610 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 afraid that we cannot share any workaround at the moment as the logged ticket is not yet investigated. As soon as it is fully analyzed, we will be able to share some updates with you. Please give us some time.
Can you please try using the latest version i.e. Aspose.PDF for .NET 22.3 and let us know in case you still notice this issue? We have tested using it and could not reproduce it.
For a bit more context, I am running this code as part of a net 6.0 docker container on Linux in Azure. The code includes Aspose.PDF 22.3.0 and Aspose.Words 22.3.0 (although this is used for something else much later on in the process)
When I run the container locally using Visual Studio (on Windows), everything is fine - as each page is compressed the memory cycles in and out.
When I run locally using Docker Desktop (Linux Containers) I encounter the same problem as described above where by after each page is compressed the memory is not released which eventually crashes the machine.
Thanks for providing more details. We have re-opened the ticket to investigate the scenario in particular environment and will let you know as soon as we have some results.