Aspose.Html Converter.ConvertTemplate throws OutOfMemoryException

We use Aspose.HTML for .NET 23.7, but we also tried the latest version 24.3.0.

When we convert thousands of JSON payloads into HTML using this function we don’t get any errors:

Converter.ConvertTemplate(
templateFilePath,
new TemplateData(jsonFilePath),
new TemplateLoadOptions(),
localOutputPath
);

But when we use this method that returns HTMLDocument, we get System.OutOfMemoryException after about 3000 conversions:

HTMLDocument htmlDoc = Converter.ConvertTemplate(
templateFilePath,
new TemplateData(jsonFilePath),
new TemplateLoadOptions()
);

We wrapped HTMLDocument in using block to release its resources explicitly. That solved the problem.

using (HTMLDocument htmlDoc = Converter.ConvertTemplate(templateFilePath, new TemplateData(jsonFilePath), new TemplateLoadOptions()))
{
. . .
}

@msaleh6

It is nice to hear that you were able to resolve your issue. Please keep using the API and feel free to create a new topic in case you need any kind of assistance.