WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
216820
Mp4 video memory leak and slow unload
https://bugs.webkit.org/show_bug.cgi?id=216820
Summary
Mp4 video memory leak and slow unload
Zorax
Reported
2020-09-22 03:10:40 PDT
I have a lot of mp4 video elements on the page that are playing at the same time. On average, their weight is 70-110kb. If i display a lot of mp4 in a video tag, then there is a big memory leak in Safari macOS, Safari iOS. There is no leakage in chrome, and it also cleans the video quickly. I'm trying to clear the video, but it looks like safari is doing too badly for this task. The page may freeze for 5-10 seconds, or completely freeze. Here's an example, you can try it in Chrome & Safari. -
http://jsfiddle.net/GhS2Z/3/
Chrome instantly removes and adds an element, while safari has a long delay >2s. And this is just 1 video, but I have more than 20 on my page.
Attachments
Sample React App & Safari Space Dump
(10.33 MB, application/octet-stream)
2021-02-10 16:27 PST
,
Balwant Bisht
no flags
Details
Test page with simple javascript to add & remove video elements
(1.58 KB, text/html)
2021-02-12 21:15 PST
,
Balwant Bisht
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2020-09-22 15:41:19 PDT
<
rdar://problem/69396335
>
Balwant Bisht
Comment 2
2021-02-10 16:27:32 PST
Created
attachment 419919
[details]
Sample React App & Safari Space Dump We are seeing similar issue in our product and due to this issue we have to significantly limit new functionality for Safari browser users as compared to Chrome. I am attaching sample react app & memory dump from Safari. You can see that "Page memory consumption" keeps on increasing when new video elements are added & removed.
Eric Carlson
Comment 3
2021-02-11 13:33:17 PST
(In reply to Balwant Bisht from
comment #2
)
> Created
attachment 419919
[details]
> Sample React App & Safari Space Dump > > We are seeing similar issue in our product and due to this issue we have to > significantly limit new functionality for Safari browser users as compared > to Chrome. > > I am attaching sample react app & memory dump from Safari. You can see that > "Page memory consumption" keeps on increasing when new video elements are > added & removed.
Does this reproduce in a standard web page, or does it only happen in a React app?
Richard Newman
Comment 4
2021-02-12 09:15:17 PST
You might want to change the summary of this bug — the sample in
Comment 2
just uses `getUserMedia` streams, so this seems to be nothing to do with MP4 video, and everything to do with <video> elements.
Balwant Bisht
Comment 5
2021-02-12 21:15:06 PST
Created
attachment 420207
[details]
Test page with simple javascript to add & remove video elements I don't see memory leak in Safari if I set srcObject to null and use simple javascript to add & remove video element. I see thread decoding the video are getting stopped when video elements were removed. But if I don't set srcObject to null before removing video element then threads keep on increasing & crashes the Safari. Setting srcObject to null in React App is still leaking memory. We are investigating it further.
Michal Marek
Comment 6
2021-03-22 07:28:32 PDT
Is there any update to this problem? Setting srcObject to null works around it, but it is not easy to do because frameworks such as React do not allow us to access the video node before removing it from the DOM.
Jer Noble
Comment 7
2021-08-20 16:02:56 PDT
I notice your fiddle sets video.src = '', but it doesn't then call video.load(). The HTML spec requires authors to call load() after setting the video's src to an empty string. If you do so, does that address your problem?
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug