Aspose.PDF Memory Leak (v23.11 and later)

Starting with Aspose.PDF v23.11.0, there is a memory leak when constructing and disposing of Document objects. Performing simple Document constructor calls in a using block does not release the memory upon garbage collection:

var pdfPaths = Directory.GetFiles(assemblyDir, "*.pdf");

foreach (string pdfPath in pdfPaths)
{
    // Using block will call .Dispose()
    using (var document = new Document(pdfPath))
    {
        string version = document.Version;
        Console.WriteLine($"Loaded Aspose Document [{Path.GetFileName(pdfPath)}]; version [{version}]");
    }
}

This same code, when run with Aspose.PDF v23.10.0 and earlier does release (most of) the memory on garbage collection.

I’ve attached a proof-of-concept console application which demonstrates the issue including garbage collection calls and output of application memory bytes at each point in its process. A Results.txt file in the project shows the different results with various versions of Aspose.PDF:

AsposePdfMemoryPOC.zip

@andyrut

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-58683

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.