jsPDF icon indicating copy to clipboard operation
jsPDF copied to clipboard

memory leak with global content and outputDestination

Open zengxiaoluan opened this issue 1 year ago • 2 comments

Hi, there, the source code below will occured a memory leak, I will share my sights after.

https://github.com/parallax/jsPDF/blob/5d09af9135a2fe049c7d3c8b95df280d22e4a6db/src/jspdf.js#L733-L742

pdf.output('blob') will call buildDocument(); after this call, the reference with conent and outputDestination still exists by closure. If you build a heavy-memory web app, it will cause serious memory leak problems after exporting a pdf and even collapse the page.

I am sorry for not providing a minimal reproduce demo, but you can hook the content on the global window and see it. I submit this issue is begging for discussion, and I would be happy to submit a pull request if Maitainer agreed with this issue.

Thanks a lot. jsPDF is an amazing library and has helped me a lot.

zengxiaoluan avatar Dec 01 '23 02:12 zengxiaoluan

This issue is stale because it has been open 90 days with no activity. It will be closed soon. Please comment/reopen if this issue is still relevant.

github-actions[bot] avatar Mar 01 '24 01:03 github-actions[bot]

(⊙o⊙)… no response

zengxiaoluan avatar Mar 04 '24 05:03 zengxiaoluan