WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
106621
Web Audio Api noteoff/stop is not releasing memory - crash
https://bugs.webkit.org/show_bug.cgi?id=106621
Summary
Web Audio Api noteoff/stop is not releasing memory - crash
Ladislav Nevery
Reported
2013-01-10 17:11:58 PST
Large or small. oneshot sources are not releasing buffers and will eat whole ram. unfortunately there is no way to do it manually like it is in webgl right now. following sample crashes webkit both mobile and dektop.as result of memory depletion ? current ipad2 mobile safari ios 6.0.1 crash after 8 oneshots played. current chrome 24.0.1312.52m crash after 17 oneshots played. var context = new webkitAudioContext(); var total=0; function onTouchStart(){ setInterval(function(){ total+=10; var source = context.createBufferSource(); source.connect(context.destination); source.buffer=context.createBuffer(1, 10*1024*1024, context.sampleRate); source.noteOn(0); source.noteOff(0); // acording to w3c spec resources should be deleted immediately. console.log(total,'mb'); },1000); } document.addEventListener( "touchstart", onTouchStart ); document.addEventListener( "click", onTouchStart );
Attachments
Add attachment
proposed patch, testcase, etc.
Chris Rogers
Comment 1
2013-01-11 10:43:53 PST
(In reply to
comment #0
)
> Large or small. oneshot sources are not releasing buffers and will eat whole ram. > unfortunately there is no way to do it manually like it is in webgl right now. > following sample crashes webkit both mobile and dektop.as result of memory depletion ? > current ipad2 mobile safari ios 6.0.1 crash after 8 oneshots played. > current chrome 24.0.1312.52m crash after 17 oneshots played. > > > var context = new webkitAudioContext(); > var total=0; > > function onTouchStart(){ > setInterval(function(){ > total+=10; > var source = context.createBufferSource(); > source.connect(context.destination); > source.buffer=context.createBuffer(1, 10*1024*1024, context.sampleRate);
It's very unusual to create a "new" distinct buffer for playing each sound. It's much better to create a single buffer, then use the same one for each AudioBufferSourceNode. This is a very artificial test which creates very huge buffers, which will of course eat up memory very quickly. It's also possible to do this in a number of other ways such as creating huge Float32Arrays, etc.
> source.noteOn(0); > source.noteOff(0); // acording to w3c spec resources should be deleted immediately. > console.log(total,'mb'); > },1000); > } > > document.addEventListener( "touchstart", onTouchStart ); > document.addEventListener( "click", onTouchStart );
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