Bug 212214 - Serious canvas memory leak in Safari (both iOS / macOS)
Summary: Serious canvas memory leak in Safari (both iOS / macOS)
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Canvas (show other bugs)
Version: Safari 13
Hardware: All All
: P2 Critical
Assignee: Nobody
URL: https://gist.github.com/kulikala/039d...
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-05-21 08:52 PDT by kaz.namba
Modified: 2021-10-18 09:08 PDT (History)
5 users (show)

See Also:


Attachments
An HTML code to reproduce (1.94 KB, text/html)
2020-05-21 08:52 PDT, kaz.namba
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description kaz.namba 2020-05-21 08:52:16 PDT
Created attachment 399958 [details]
An HTML code to reproduce

Safari crashes because of memory leak.
This issue occurs both on iOS and macOS.

I attached the reproduction code, also put it on the Gist.
https://gist.github.com/kulikala/039d7c94f46ee860f1f9e2714104cb90

Trigger condition is same with the following issue:
https://bugs.webkit.org/show_bug.cgi?id=134355

> ctx.drawImage(anotherCanvas, clipX, clipY, clipW, clipH, x, y, w, h) --> memory leak.
> ctx.drawImage(anotherCanvas, x, y, w, h) --> no memory leak.

There's a slight difference with my reproduction code: the image source is switched to HTMLVideoElement.

I confirmed this memory leak via Web Inspector's Timelines tab.
Page category of memory instrument keeps growing and reaches 3GB (my MacBook Pro has 16GB memory).
Comment 1 Alexey Proskuryakov 2020-05-21 10:53:46 PDT
Safari kills the page for using too much memory in a few seconds.
Comment 2 Radar WebKit Bug Importer 2020-05-21 10:53:57 PDT
<rdar://problem/63500557>
Comment 3 Simon Fraser (smfr) 2020-05-21 13:31:15 PDT
What macOS/iOS versions are you reproducing this on?
Comment 4 kaz.namba 2020-05-21 13:46:12 PDT
I confirmed the reproduction on

macOS: Catalina v10.15.4
  Safari: v13.1 (15609.1.20.111.8)

iOS: v13.5