We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Memory leak in PngDevice process in Linux

Hello!
Looks like you have an issue when running Process method for PngDevice under Linux.
Source code:
while (true)
{
using (Document doc = new Document(name))
{
int pageCount = doc.Pages.Count;

	PngDevice device = new PngDevice(ImageResolution);

	for (int i = 1; i <= pageCount; i++)
	{
		using (MemoryStream imageStream = new MemoryStream())
		{
			device.Process(doc.Pages[i], imageStream);
		}
	}
}

}
Under windows there are no memory leaks were found, but in Docker container with Linux, I see leaks near 0.5 Mb per document page.
I use .NET Core 3.1, and Aspose 21.8.0. Also, I tested the code on the latest 21.11.0 with the same result.
Could you please check the issue?

@Aleksandr_Kuznetsov

Could you please ZIP and attach your input PDF file here for testing? Please also share how are you checking the memory leakage. We will follow the same steps to reproduce the same issue at our end and provide you more information on it.

You may use any document from the attached archive pdfs.zip (1.2 MB), but it looks like a stable issue, not related to the document.
For testing memory leaks, I used:

  1. docker stats - for collect info about memory and processor usage from my local docker
  2. internal C# commands:
    var proc = Process.GetCurrentProcess();
    var mem = proc.WorkingSet64 / (1024 * 1024);
    then I write it to logs (for real docker container in AWS) or to console (for doublecheck on my local computer).
  3. AWS console for checking container memory usage. And AWS periodically closes my container by out of memory.
    You may see test results in the attached archive: memoryUsage.zip (48.5 KB)

I also attached the full test solution (without a license file) AsposeMemoryLeakTest.zip (34.8 KB). You will need to add a valid license file, because in docker I see an error “Exception on render page image to stream: System.Exception: No suitable system fonts found” for the empty license (and it looks like another non-critical issue too).

@Aleksandr_Kuznetsov

We have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as PDFNET-51046. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.