webaudiomodules / webdx7

virtual Yamaha DX7 synth
https://webaudiomodules.org/wamsynths/dx7
MIT License
139 stars 24 forks source link

Memory leak #12

Open dronus opened 2 years ago

dronus commented 2 years ago

If creating several instances of DX7() and dropping them, they will leak an object called "WAP", as can be detected with eg. the Chromium Dev Tools Heap Profiler.
As "WAP" holds reference to the whole WebAssembly heap and further objects, this causes an exception in DX7() constructor at some point (some 1000 instances, maybe there is some overall WebAssembly heap limit or something).

Interestingly this even holds true if: -all DX7 objects are created for the same AudioContext -they are never connected to any node. -also holds true for OfflineAudioContext, even if it is never rendered (and thus no AudioNodeProcessor ever is run)

So basically invoking the constructor seems enough to have DX7 leak one instance of WAP forever.