4 <title>Test GC of AudioBufferSourceNode
</title>
7 var bufferLengthSeconds
= 120;
13 context
= new AudioContext();
15 // Continuously create AudioBufferSourceNodes with large AudioBuffers and immediately drop
16 // the references. This should not crash the browser.
17 setInterval(function () {
18 var source
= context
.createBufferSource();
19 var buffer
= context
.createBuffer(1, bufferLengthSeconds
* context
.sampleRate
, context
.sampleRate
);
20 source
.buffer
= buffer
;
24 if ((count
% 100) == 0)
25 console
.log(count
+ " nodes generated");
33 This tests that we clear up source buffers that were never connected nor started. Press the
34 button to run the test. If everything is working correctly, there will be no crash. Watch the
35 messages in the console. Run this for at least
5000 nodes (see console for node count).
37 <button onclick=
"runTest()">Run AudioBufferSourceNode GC Test
</button>