Calling html2canvas multiple times increases memory usage.
It appears the clean up of the cloned nodes is not working as expected, or Chrome isn't cleaning it up.
me too, wait fix...
I use vue-cli3, calling html2canvas multiple times increases memory usage, and fail to compile my project.
Otherwise, some picture in my page can't display, calling several times but no out of usage.
I am having the same problem. The nodes are all detached but aren't being garbage collected.
Hello! I made some memory profiling using chrome and found a bottleneck with one closure, in my case I commented out the code snippet which isn't used in our case, so this solves the issue for us.
Thanks for the suggestion @ThunderWorm, but unfortunately this did not fix the problem for me.
We fixed our memory leak by making a change in the file Clone.js around line 541.
The previous code was:
It seems that this kept a reference to documentClone so it was never deleted. Instead we made the function async to wait for the response from iframeLoader.
The code looks like this:
This seems to be fixed in the last version (1.0.0-rc3).
However, in this version, logging cannot be disabled due to a bug.
This bug still happen in the last version (1.0.0-rc5). Please fixed this.
Any good news here? I got the problem too.
I'm also very troubled about this bug...
I use last version (1.0.0-rc.5).
I called canvas.remove() after called html2canvas but heap memory remained.
Do you have any idea to delete heap memory by html2canvas?
I recommend this one: https://github.com/bubkoo/html-to-image. It is very easy to use. The multiple screenshot function can be realized without memory leak.
Most helpful comment
This bug still happen in the last version (1.0.0-rc5). Please fixed this.