We were originally using 18.6 to build pdfs from mixed images (mostly tiffs) and pdfs. We encountered a few issues with that version and pdf corruption, and so upgraded to version 21.3. In 21.3 we have encountered a major memory leak. The services that perform these operations regularly hit 40+GB of ram usage with no signs of the increase stopping.
While trying to figure out the source of this memory issue I put together a small sample application that shows the memory leak. It is a very simple application that just creates a new pdf, adds a single page tiff and a 12 page color pdf to the output pdf, and then saves the file. It then outputs a rolling average of the current working set to the console. I used a rolling average as it aids when trying to show trend lines. The application clearly shows the memory leak occurring.
This is a major issue, and is causing significant issues with our customers. I have attached the application below. It was written in C# for VS 2017. It runs in an infinite loop, creating and saving the pdf. If you see a code issue that might be causing it, please tell me what it is so that I can test the outcome.
MemoryLeak-CreatePDF.zip (1.0 MB)