Aspose.Html.Converter.ConvertHTML, runaway memory leak

Our team is attempting to convert HTML documents to PDF using Converter.ConvertHTML(document, options, destination)). We have a few files that are causing out of memory exceptions, and have been able to isolate an example. We are currently using the latest version of Aspose.HTML (25.6.0). Here is the code we use:

        using (var document = new HTMLDocument(source))
        {
            var options = new PdfSaveOptions();
            options.PageSetup.AnyPage = new Page(new Margin(25, 25, 25, 25));
            options.PageSetup.AdjustToWidestPage = true;
            Converter.ConvertHTML(document, options, destination);
        }

compare.png (45.8 KB)

html_memory_issue.zip (9.5 KB)

See attached samples of “bad” and “good” html. The difference in the html is highlighted in the attached “compare.png” image above.

Here is the VS 2022 performance profile, showing a steady climb in memory (3+ GB, and going) when trying to convert the sample html files which are only 27K in size.

image.png (38.8 KB)

@msternig

We are checking it and will get back to you shortly.

1 Like

@msternig

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): HTMLNET-6491

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.

@msternig

Hey, my project has the same issues. Have you identified anything as “bad” html, and are you able to share your files? I do not have access from this thread.

The only thing that I found was that there was a div with a unique ID attribute. Then a style tag was included that tried to apply a border, padding, and width to “th” tags in that particular div. If I removed the style tag or changed the ID of the div (to prevent the style from applying), the conversion to PDF was fine. My attachment above called “compare.png” shows this.

@msternig @simensnc

Currently, the ticket is pending for the resolution and we are looking into it. As soon as it is resolved, we will update in this forum thread.

@simensnc

If you are facing similar issue, you can create a new topic with your file so that we can address it in a dedicated ticket separately.

@asad.ali - checking to see if there is a timeline on a fix for this bug? I understand this is not a paid support item, but it’s a defect that is impacting several clients and our ability to use your tool. Thank you!

@msternig

The ticket is currently under the investigation phase and we are afraid that we are not in a position to share any ETA. As soon as investigation is complete, we will share updates with you about ticket resolution. Please be patient and spare us some time.

We are sorry for the inconvenience.

Any update on this defect being resolved? Thank you!

@msternig

We are actively working to resolve the issue, though we currently don’t have a specific timeline to share. Rest assured, we will keep you updated as soon as we have progress to report. We appreciate your patience and sincerely apologize for any inconvenience caused.

Any update on a resolution to this issue? We have attempted several workarounds, but have multiple production efforts that are stalled as a result of this defect.

@msternig

We would like to share with you that the issue has been resolved in 25.8 version of the API which will be rolled out in this month i.e. August 2025. We will let you know as soon as 25.8 version is released.

The issues you have found earlier (filed as HTMLNET-6491) have been fixed in this update. This message was posted using Bugs notification tool by avpavlysh