WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
95757
AudioContext is never destructed.
https://bugs.webkit.org/show_bug.cgi?id=95757
Summary
AudioContext is never destructed.
Pavel Podivilov
Reported
2012-09-04 10:42:03 PDT
I just noticed that V8AudioContext::constructorCallback in V8AudioContextCustom.cpp leaks the pointer to AudioContext. Shouldn't it also call V8DOMWrapper::setJSWrapperForActiveDOMObject to deref AudioContext in JS wrapper weak callback? Looks like currently all AudioContexts live forever.
Attachments
Add attachment
proposed patch, testcase, etc.
Kentaro Hara
Comment 1
2012-09-04 17:38:55 PDT
I'll take a look.
Pavel Podivilov
Comment 2
2012-09-05 00:30:55 PDT
There is another problem with this code. After fixing the leak, you'll get debug crash in AudioContext::uninitialize. Here is why. ScriptExecutionContext::stopActiveDOMObjects is called twice on navigation, first time from Document::detach and then from FrameLoader. As a result AudioContext::stop is also called twice. First AudioContext::uninitialize deletes the AudioContext object. Then AudioContext::uninitialize is called again, but AudioContext is already destructed.
michaelbraithwaite
Comment 3
2012-11-09 03:19:05 PST
Would this explain why we hit the exception "audio resources unavailable for AudioContext construction" so often? The 4 AudioContext limit gets exhausted even though at most one is currently active. I assumed there is no guarantee the unused ones will be garbage collected in any event. As this is in V8*.cpp is this only in Chrome? Safari hits the same issue. If it is a separate issue I'll bug it, though I think in part its a spec issue with the lack of 'destroy' method on the JavaScript AudioContext. If it is a finite resource and given when gc gets invoked is not controllable from JavaScript it means sometimes it fails which means users get no audio (or an broken app). For a single page web app where multiple 'apps' run on it the life time model doesn't seem great. You can see this on
https://turbulenz.com/
if you keep reloading some of the games.
Chris Rogers
Comment 4
2012-11-09 10:26:52 PST
The AudioContext releases its resources in AudioContext::uninitialize(), not in the destructor, so delayed garbage collection is not likely to be the issue. Michael, I'll have a look at your case...
Chris Rogers
Comment 5
2012-12-12 14:31:02 PST
I believe this was fixed in:
http://trac.webkit.org/changeset/135152
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