NEW 66805
MediaElementAudioSourceNode lives longer than necessary
https://bugs.webkit.org/show_bug.cgi?id=66805
Summary MediaElementAudioSourceNode lives longer than necessary
Chris Rogers
Reported 2011-08-23 13:40:30 PDT
On Tue, Aug 23, 2011 at 12:49 PM, Chris Evans <cevans@google.com> wrote: Here's my immediate puzzle: <script> a = document.createElement("audio"); delete a; window.gc(); </script> <script> a = document.createElement("audio"); c = new webkitAudioContext(); m = c.createMediaElementSource(a); delete a; delete c; delete m; window.gc(); </script> Can you help me work out why the first script destroys the HTMLAudioElement but the second does not? (You can put a printf in the constructor and destructor if you like) Something must be referencing that DOM node but I can't work out what the code is doing to cause that. ..................... Hi Chris, Yes, basically the problem ultimately is coming about because an AudioContext is an ActiveDOMObject and lives as long as the document exists (it will be available for garbage collection only after its stop() method is called). Also, in the nascent MediaElementAudioSourceNode implementation, the context is calling ref() on MediaElementAudioSourceNode even before it's connected. It should only ref() the node when it's actually connected, then deref() when it's disconnected.
Attachments
Abhishek Arya
Comment 1 2011-08-25 10:48:23 PDT
Chris Rogers
Comment 2 2011-09-20 12:48:02 PDT
This bug is confusing two different problems. The original security issue was fixed here: http://trac.webkit.org/changeset/94608 The second issue is not nearly as serious which is that the MediaElementAudioSourceNode *could* be deleted through garbage collection sooner than it actually is (since the context keeps it around longer than necessary). It's not a leak - just stays around longer than necessary
Radar WebKit Bug Importer
Comment 3 2012-08-21 17:27:53 PDT
Note You need to log in before you can comment on or make changes to this bug.