Bug 134606

Summary: Audio Context isn't being collected sufficiently eagerly.
Product: WebKit Reporter: Gprog <gprog.dev>
Component: Web AudioAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: ap, crogers, jer.noble, mhahnenberg
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Linux   
See Also: https://bugs.webkit.org/show_bug.cgi?id=134425

Description Gprog 2014-07-03 12:34:03 PDT
If I do this as below , after I click on the "TEST 1" button, it creates Audio Context thread but if I click it again it doesn't destroy the older Audio Context object rather creates another Audio Context (spawning another thread) on top of it. 
After doing this multiple times, it fails because of the cap limit on the number of Audio Context that can be created simultaneously.

I also tried forcing a Javascript GC (calling JSC::Heap::collectAllGarbage) by opening the inspector window but it doesn't clear these Audio Context objects which are there until I do a reload on the page which calls JSC::Heap::collectAllGarbage and clear off all the Audio Context objects created.

<html>
<body>
<h4> WEB AUDIO TEST </h4>
<canvas id='canvas' width='800px' height='500px'></canvas>
<button type="button" onclick="test()" width="200" height="300">TEST 1</button>
<script type='text/javascript'>
function test()
{
	if(true)
	{
		var testCtx = new webkitAudioContext();
		var audioSource = testCtx.createBufferSource();		
	}
}

</script>
</body>
</html>