Open
Bug 1232279
Opened 9 years ago
Updated 2 years ago
HTML video leak memory when constantly change the source with JavaScript
Categories
(Core :: Audio/Video: Playback, defect, P3)
Tracking
()
UNCONFIRMED
People
(Reporter: browser_defects, Unassigned)
Details
(Whiteboard: [memshrink:P2])
Attachments
(3 files)
User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.80 Safari/537.36 Steps to reproduce: 1. Create two video elements and attach them in DOM using JavaScript 2. Add canplay and play event listeners to the one of the video elements (I will call it buffer) 3. Add a source to the buffer video element 4. When canplay event is fired play the video 5. When play event is fired swap both video elements, remove canplay and play event listeners from buffer video element and load a new source to it. 6. Repeat steps 1 to 5 twenty times. Actual results: Memory usage increase continuously. Expected results: Memory usage should be stable.
Reporter | ||
Comment 1•9 years ago
|
||
Working prototype can be found here: http://download.milestonesys.com/14122015tvh/leak.html
I tested with FF42 on Win 7, the RAM use is fine, but the CPU use spikes to 75%!
Reporter | ||
Comment 3•9 years ago
|
||
I have noticed that when started in safe mode there is no leaking of memory but the CPU load is very high.
Comment 4•8 years ago
|
||
Safe mode not leaking is interesting... Perhaps related to use of HW decoders/GMP?
Component: Audio/Video → Audio/Video: Playback
Whiteboard: [memshrink]
Reporter, can you attach a memory log in normal mode and in safe mode (both with a fresh profile https://support.mozilla.org/en-US/kb/profile-manager-create-and-remove-firefox-profiles). To save memory log, type about:memory in the location bar, measure and save.
Flags: needinfo?(browser_defects)
Reporter | ||
Comment 6•8 years ago
|
||
Flags: needinfo?(browser_defects)
Reporter | ||
Comment 7•8 years ago
|
||
Go to about:memory and click on "Minimize memory usage". Does this free up the memory?
Comment 9•8 years ago
|
||
The first memory report file looks unusual: > 88.66 MB (100.0%) -- explicit > > 1,048.36 MB ── private > 977.60 MB ── resident explicit is really low but private and resident are high. So our internal measurements are clearly missing some significant source of memory usage... which suggests something gfx related :/
Comment 10•8 years ago
|
||
I tried the test from comment 1 on Linux. CPU usage went up to 450% but memory usage was fairly stable around 300 MiB (both e10s and non-e10s).
Comment 11•8 years ago
|
||
On Windows, the WMF decoder typically keeps up to 30 decoded frames internally. This video is 352x288 at 8fps, we have 40 decoders. Each frame will be 152kB, and there are 8 of them per video. so 152kB * 8 * 40 = 48MB for the frames themselves, that could easily be doubled as we have the compositor having a copy to paint them while we're decoding some more. Each decoder takes a fair amount of memory: we have the entire context, task queue, the lot. I'm not particularly concerned with 300MB usage. CPU usage is very high, but this may be related to bug 1239899.
Updated•8 years ago
|
Priority: -- → P2
Comment 12•8 years ago
|
||
Can you selectively re-enable your add-ons to help determine which one is causing the high memory usage?
Flags: needinfo?(browser_defects)
Comment 13•8 years ago
|
||
Safe mode also turns off hardware acceleration, we think, so you could also try disabling that and see if it helps. We've seen many cases where particular graphics drivers use a lot of memory.
Reporter | ||
Comment 14•8 years ago
|
||
I tried another long running test overnight without Safe mode but no add-ons enabled. The result in the morning was 2,8 GB memory consumption and all frozen picture. I tried to get memory profile snapshot but then FF crashed. Version used was 44.
Flags: needinfo?(browser_defects)
Updated•8 years ago
|
Whiteboard: [memshrink] → [memshrink:P2]
Reporter | ||
Comment 15•8 years ago
|
||
Another long running test ( 9 hours ) with FF 44, no add-ons, no hardware acceleration, memory remains stable at just under 400 MB. CPU usage is very high at close to 100% on i7-4810MQ but I guess this is to be expected. The leak is confirmed with hardware acceleration on both Intel and NVidia video cards - both with latest drivers.
Comment 16•8 years ago
|
||
I cannot reproduce this leak on trunk (non-e10s, although playing the videos seems to start a plugin-container process?) with the URL listed in comment 1. Memory usage while playing the videos is stable at ~450MB over the course of an hour (lower for the main process, higher for the plugin process). The machine is Windows 7 with an integrated Intel graphics card; about:support for graphics says: Adapter Description Intel(R) HD Graphics 5500 Adapter Drivers igdumdim64 igd10iumd64 igd10iumd64 igdumdim32 igd10iumd32 igd10iumd32 Adapter RAM Unknown Asynchronous Pan/Zoom wheel input enabled; touch input enabled Device ID 0x1616 Direct2D Enabled true DirectWrite Enabled true (6.3.9600.18123) Driver Date 4-29-2015 Driver Version 10.18.14.4206 GPU #2 Active false GPU Accelerated Windows 1/1 Direct3D 11 (OMTC) Subsys ID 222617aa Supports Hardware H264 Decoding Yes Vendor ID 0x8086 WebGL Renderer Google Inc. -- ANGLE (Intel(R) HD Graphics 5500 Direct3D11 vs_5_0 ps_5_0) windowLayerManagerRemote true AzureCanvasBackend direct2d 1.1 AzureContentBackend direct2d 1.1 AzureFallbackCanvasBackend cairo AzureSkiaAccelerated 0 I'm unsure whether my drivers are the newest possible or not. I will try other versions to see if I can reproduce the problem. What does the graphics section of about:support say for you?
Flags: needinfo?(browser_defects)
Comment 17•8 years ago
|
||
I have a 44b1 browser that's been running the webpage in comment 1 for ~45 minutes, same about:support output (no H264 decoding, because "too many DXA videos playing"). The memory according to Task Manager does appear to be going up somewhat (steady at ~300MB at the start, now around ~330-350MB). An about:memory report shows nothing out of the ordinary. I'll let it play for another hour or two and take an about:memory snapshot.
Comment 18•8 years ago
|
||
(In reply to Nathan Froyd [:froydnj] from comment #17) > I have a 44b1 browser that's been running the webpage in comment 1 for ~45 > minutes, same about:support output (no H264 decoding, because "too many DXA > videos playing"). The memory according to Task Manager does appear to be > going up somewhat (steady at ~300MB at the start, now around ~330-350MB). > An about:memory report shows nothing out of the ordinary. I'll let it play > for another hour or two and take an about:memory snapshot. The memory usage is unchanged. As a result, I don't think an about:memory snapshot would be helpful.
Reporter | ||
Comment 19•8 years ago
|
||
Attached is the about:support that was requested.
Reporter | ||
Comment 20•8 years ago
|
||
Information provided in attachment 8763514 [details]
Flags: needinfo?(browser_defects)
Mass change P2 -> P3
Priority: P2 → P3
Comment hidden (spam) |
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•