Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Large Html conversion consume much memory #962

Open
Hikariqz opened this issue Jan 23, 2024 · 2 comments
Open

Large Html conversion consume much memory #962

Hikariqz opened this issue Jan 23, 2024 · 2 comments

Comments

@Hikariqz
Copy link

Hikariqz commented Jan 23, 2024

Hi guys,

I'm having an issue where converting a large HTML document to PDF is consuming a significant amount of memory. The HTML represents around 1200 pages, but the file size is only around 3MB.

When generating the PDF, I noticed my Java VM memory usage increasing up to around 1GB. I used a profiler to investigate further and found that a lot of byte arrays were being created during the PDF generation process. Most of the memory usage appeared to be occurring in calls to com.openhtmltopdf.css.newmatch.Condition#matches which involves java.lang.StringBuilder.toString or java.lang.StringBuilder.

image

I'm hoping someone may be able to provide some help or insights on how I could optimize this process to use less memory. Converting such a large number of HTML pages to PDF seems to be straining the memory usage and I want to find a more efficient way to handle it.

Really appreciate it!

@Hikariqz Hikariqz changed the title Large Html conversion consume a lot memory Large Html conversion consume much memory Jan 23, 2024
@siegelzc
Copy link

siegelzc commented Jan 23, 2024

I'm going to take a look at this. I'm also working with some pretty large HTML files, so this affects me too. In the meantime, I'm going to tag you on a duplicate issue at a forked repository where we're going to be doing new development. (see #921)

See: openhtmltopdf#1 (comment)

@Hikariqz
Copy link
Author

Thank you @siegelzc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants