Bug 222723 - Canvas Memory Leak
Summary: Canvas Memory Leak
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Canvas (show other bugs)
Version: Safari 14
Hardware: Mac (Intel) macOS 11
: P1 Blocker
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-03-04 01:44 PST by Roman Nikitin
Modified: 2021-03-19 13:25 PDT (History)
6 users (show)

See Also:


Attachments
memory usage screenshot (131.30 KB, image/png)
2021-03-04 01:44 PST, Roman Nikitin
no flags Details
Profile file (4.07 MB, application/json)
2021-03-08 22:37 PST, Roman Nikitin
no flags Details
Chrome profile (9.75 MB, application/json)
2021-03-11 03:36 PST, Roman Nikitin
no flags Details
Safari profile (4.13 MB, application/json)
2021-03-11 03:37 PST, Roman Nikitin
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Nikitin 2021-03-04 01:44:56 PST
Created attachment 422201 [details]
memory usage screenshot

In Canvas with big count of elements memory reaches limit. It can be about 2GB. Unfortunately, I can't profile it, because dev tools fails. But in Chromium same canvas takes about 200mb. 
I found old tickets about the same problem, but they are not solved. This problem is critical for our product.
Comment 2 Alexey Proskuryakov 2021-03-05 13:35:05 PST
Could you please provide a test that reproduces this issue?
Comment 3 Roman Nikitin 2021-03-08 22:37:39 PST
Created attachment 422665 [details]
Profile file
Comment 4 Roman Nikitin 2021-03-08 22:38:19 PST
I've added profile file. Did you mean it?
Comment 5 Simon Fraser (smfr) 2021-03-09 10:05:47 PST
We need a link to a web page which we can load ourselves to investigate the issue.
Comment 6 Roman Nikitin 2021-03-11 00:05:10 PST
We are preparing example with not sensitive information, wait please
Comment 7 Radar WebKit Bug Importer 2021-03-11 01:45:22 PST
<rdar://problem/75307418>
Comment 8 Roman Nikitin 2021-03-11 03:35:44 PST
I've prepared link where leak happens https://miro.com/app/board/o9J_lQfOEOc=/

My actions:
 - I see all "frames" in board
 - I try to zoom to one "frame"

In safari memory it takes about 2gb memory - limit was reached
In chrome memory it takes 200mb in peak

I've added new profile files
Comment 9 Roman Nikitin 2021-03-11 03:36:22 PST
Created attachment 422919 [details]
Chrome profile
Comment 10 Roman Nikitin 2021-03-11 03:37:14 PST
Created attachment 422920 [details]
Safari profile
Comment 11 Roman Nikitin 2021-03-15 22:42:44 PDT
Do you have any updates?
Comment 12 Simon Fraser (smfr) 2021-03-16 11:44:22 PDT
What version of Safari are you testing, and on what OS version?
Comment 13 Roman Nikitin 2021-03-16 12:02:16 PDT
I have MacOS 11.2.2 and Safari 14.0.3
Comment 14 Said Abou-Hallawa 2021-03-16 12:50:28 PDT
When doing little editing in https://miro.com/app/board/o9J_lQfOEOc=/, Safari can reach 1GB on my machine.

Chrome uses three processes when opening this page (Google Chrome, Google Chrome Helper "Renderer" and Google Chrome Helper "GPU"). The total memory of these processes is about 880MB.

So Safari takes 16% more than Chrome. But regardless of this, 1GB memory is a huge amount of memory to be taken by one page.
Comment 15 Roman Nikitin 2021-03-17 00:51:40 PDT
If I understand correctly, Chrome can parallel some processes and because it works faster them Safari? And now webkit doesn't have problems with memory and garbage collection. Could you confirm it?
Comment 16 Said Abou-Hallawa 2021-03-19 13:00:25 PDT
The page https://miro.com/app/board/o9J_lQfOEOc=/ has three full screen canvases. On my iMacPro, each takes 5120 x 2776 pixels. The size of each backing IOSurface is 56,852,480 bytes. This is almost 57MB.
Comment 17 Roman Nikitin 2021-03-19 13:25:39 PDT
Okay, thanks. I will try to find more information about memory using. If I find something, can I write here?