Memory leak converting HTML to PDF

At Aspose.PDF v18.11.0 you introduced a memory leak when converting HTML to PDF. Allocated RAM is not garbage collected and child threads remain for all subsequent calls which quickly gobbles up system RAM. The below simplest implementation demonstrates the issue. Please fix it.

using System;
using System.IO;
using System.Text;
using Aspose.Pdf;

namespace AsposeHtmlToPdfMemoryLeak
{
    class Program
    {
        static void Main(string[] args)
        {
            var outPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + Path.DirectorySeparatorChar + "AsposePdf" + Path.DirectorySeparatorChar;
            var html = "<h1>Header</h1>";

            var makePdf = new MakePdfDocument();

            Console.WriteLine("Press Enter to begin.");
            Console.ReadLine();

            for (int i = 0; i < 250; i++)
            {
                makePdf.Create(i, html, outPath);
            }
            Console.WriteLine("Press Enter to terminate.");
            Console.ReadLine();
        }
    }

    class MakePdfDocument
    {
        public void Create(int counter, string html, string outPath)
        {
            var outFile = outPath + counter.ToString() + ".pdf";

            using (var memStream = new MemoryStream(Encoding.UTF8.GetBytes(html)))
            using (var pdf = new Document(memStream, new HtmlLoadOptions()))
            {
                pdf.Save(outFile);
            }

            Console.WriteLine(outFile);
        }
    }
}

@isknight

Could you please try using Aspose.PDF for Java 19.3 in your environment as latest version is always recommended for use and in case you still face any issue, please share complete environment details (i.e. OS Name and Version, Application Type, JDK Version, etc.) along with sample HTML file. We will further test the scenario in our environment and address it accordingly.

I refer to all versions of Aspose.PDF for .NET from v18.11.0 to v19.3.0 and I have tested the scenario I gave you in all versions since v18.11.0 hence why I can confirm that the issue was introduced at version v18.11.0. The last working version is v18.10.0.

Please review the C# code sample already given which is using a HTML string and memory stream so there is no need for a separate HTML file.

I am posting this in the free support forum as the paid support forum is not working and we are a paid support customer.

@isknight

We apologize for the confusion.

We have tested the scenario in our environment and were able to notice the memory consumption kept increasing upon subsequent calls of the method. Hence, we have logged an issue as PDFNET-46230 in our issue tracking system. We will surely investigate the issue in details and keep you posted with the status of its correction. Please spare us little time.

We are sorry for the inconvenience.

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