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

Memory leak with canvas context clearRect and fillText #511

Open
JohnKlenk opened this issue Sep 18, 2024 · 2 comments
Open

Memory leak with canvas context clearRect and fillText #511

JohnKlenk opened this issue Sep 18, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@JohnKlenk
Copy link

There is a significant memory leak (equally in 1.3 and 1.4) with canvas context clearRect and fillText. fillText() is worse, at nearly 400 bytes each time it is called. fillRect() does not appear to leak.

We created a tiny html file (canvasleak.zip), which you can load in ultralight's "Sample 8 - Web Browser" that demonstrates the leak at a rate of over 1GB per minute so that it can be easily observed, as smaller leaks can be tricky to notice amid the normal ups and downs of allocation and garbage collection. Click on the page to begin the animation and again to pause it. It counts off seconds and frames so that you can easily measure out a minute of memory leak which occurs at a rate of approximately 500KB/frame. It uses 1000 canvases, feel free to change the settings--you can observe the same leak with a single canvas (just a lot slower).

@adamjs adamjs self-assigned this Oct 2, 2024
@adamjs adamjs added the bug Something isn't working label Oct 2, 2024
@adamjs
Copy link
Member

adamjs commented Oct 2, 2024

Thanks for the report, I've applied a mitigation for this in 1.4 trunk that significantly reduces the memory growth (should be live now in latest 1.4-dev bins). A full fix actually requires an allocator rehaul so that we can share resources more intelligently (now planned in 1.4.1).

@JohnKlenk
Copy link
Author

Thanks. I'm seeing about a 50% improvement with the latest dev build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants