MemoryLeak when extracting images from PDF

Hello,

we use the code in the attached example project to extract the first image of a PDF as Bitmap.

We have been finding out a memory leak, if we call the code several times (500 times in the attached example). What we see is that the leak occurs on your side (see attached screenshots of the memory analysis from dotMemory after running the attached program.

Please tell us how to extract the first image of a PDF as bitmap without memory leaks or fix this problem.

MemLeakClass.zip (24,1 KB)
MemLeakScreeny.png (69,9 KB)

Kind Regards,
Andy

Addendum: The leak occurs currently only wih the PDF in the example project!

@AStelzner
Thank you for writing. Unfortunately, I do not have dotMemory, but when checking using GC methods, the leaks were confirmed. I tried changing the code a little, but it didn’t work.

for (var i = 1; i < 1500; i++)
{
    Console.WriteLine($"Call #{i}");

    var objectWithMemLeak = new MemLeakClass();
    var v = objectWithMemLeak.GetBitmapOfFirstPage(new Size(50, 50));
    v.Dispose();

    Console.WriteLine($"..Done{Environment.NewLine}");
}

I will create a task on this issue.

@AStelzner
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFNET-53699

You can obtain Paid Support services if you need support on a priority basis, along with the direct access to our Paid Support management team.

1 Like

The issues you have found earlier (filed as PDFNET-53699) have been fixed in Aspose.PDF for .NET 24.10.

1 Like