Bug 156624

Summary: ConvolverNode never releases memory after use
Product: WebKit Reporter: Bjorn M <bjorn.melinder>
Component: Web AudioAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Major CC: barraclough, jer.noble
Priority: P2    
Version: Safari Technology Preview   
Hardware: Mac   
OS: OS X 10.11   

Description Bjorn M 2016-04-15 05:13:13 PDT
ConvolverNodes potentially allocate a lot of memory when assigned a buffer. It seems this memory is never released after use or after setting the buffer to null. On iOS Mobile Safari this causes low memory warnings and crashes. On Safari for Mac it can lead to allocation of 10G+ and crashing too. To reproduce:

https://jsfiddle.net/2eqq65mo/

I would expect conv.buffer = null to release the memory. It would be good if there was such an eager way of releasing the memory without having to wait for the next javascript GC.

I would also expect the javascript GC (or the variable going out of scope in the example above) to trigger the release. However, it seems the memory is not released by javascript GC. I'm guessing the ConvolverNodes are released whereas the underlying Reverb objects are not. 

When used in an OfflineAudioContext, the memory is never released either.

FYI I filed the same bug for Chrome as well: https://bugs.chromium.org/p/chromium/issues/detail?id=603256