Image Conversion - Memory leak

Using Aspose.net PDF purchased this year, I made an winform program which converts PDF first page to PNG file.
However, it threw an outofmemory error every time.
I found that there is a memory leak as shown in the below picture.
image.png (32.0 KB)

Please check the memory leak.

static pdfAspo.Document _pdfDocument;
static PngDevice _pngDevice;
using (FileStream imageStream = new FileStream(transFileNameTall, FileMode.CreateNew))
{
Resolution resolution = new Resolution(350);

                    // Create PNG device with specified attributes (Width, Height, Resolution)
                    _pngDevice = new PngDevice(resolution);

                    // Convert a particular page and save the image to stream
                    _pngDevice.Process(_pdfDocument.Pages[1], imageStream);

                    _pdfDocument.Pages[1].Dispose();

                    _pdfDocument.Dispose();

                    // Close stream
                    imageStream.Close();
                }

@leekydo

Would you please share your sample PDF document with us as well. We will test the scenario in our environment and address it accordingly.

I converted the attached pdf file 50 times in a row.

Please refer to the result, and check the file.
image.png (32.9 KB)

Getting Started.pdf (1.9 MB)

@leekydo

We were able to notice that memory usage was not getting back to normal after completion of the loop of 50 iterations. Hence, we have logged an issue as PDFNET-49069 in our issue tracking system for the sake of correction. 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.

@leekydo

We made some tests using the 21.4 version of the API and did not notice large memory consumption. We made a test in which this code was called 3 times consecutively. After the first time, the picture was similar - several KBs of memory were added. But after the second and third calls, there was no memory addition (the difference is <200 bytes). That is, no large memory consumption was detected.
We also attached a picture for illustration. image02.png (24.2 KB)

Would you please try using the latest version of the API i.e. 21.4 and let us know in case you still notice any issues. It is also desirable to know in which environment you are running the code snippet and using the API (version .NET, etc.)?