[Webkit-unassigned] [Bug 46560] [LEAK] Removing video element will not free assigned memory
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Oct 30 17:59:26 PDT 2014
https://bugs.webkit.org/show_bug.cgi?id=46560
--- Comment #9 from Jer Noble <jer.noble at apple.com> ---
(In reply to comment #7)
> I would like to confirm that this is still a problem. I can reliably
> recreate the problem with the attachment in this comment. Right now, the
> test has a hardcoded for the local path
> "/home/patrick/Downloads/big_buck_bunny.mp4", with the same file copied at
> "/home/patrick/Downloads/big_buck_bunny2.mp4".
>
> There are three buttons in the test. I ran "top" in a terminal and kept
> checking the memory consumption of WebKit while running this test in the
> Epiphany browser.
>
> The "Toggle Video" button will flip the video's "src" attribute between the
> "big_buck_bunny.mp4" and "big_buck_bunny2.mp4" files. Note that no memory
> leak occurs.
>
> The "Add/Remove Video" button will create and add the video node to the DOM,
> then remove it the next time the button is clicked. A memory leak occurs
> when clicking this repeatedly.
Removing the element from the DOM does not immediately free the element, it simply makes it available to the garbage collector. Until the GC specifically destroys that element, memory used by that element will not be freed. This is not a memory leak.
If you force GC to be run (either through your browser's developer tools, or by creating lots of high-memory objects), the video element will eventually be destroyed by GC.
However, there are things WebKit could change to make GC more likely, and to ensure that the video element is destroyed when GC is run. MediaPlayerPrivate exposes a method called "extraMemoryCost()" to be implemented by media engines, which reports the extra memory cost used by the media engine to load, decode, and display the media resource. It sounds like whatever port is being used by the Epiphany browser does not implement this method, and the GC doesn't know how much memory is being used by the video element.
It does appear, however, that you have discovered a good workaround: set src="" and call load() before removing the element from the DOM.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20141031/0b3189ff/attachment-0002.html>
More information about the webkit-unassigned
mailing list