Every call to wavesurferjs keeps on increasing RAM memory, without releasing it on destroy.
See original GitHub issueI have came across a issue with wavesurferjs
it does not release memory previously held upon destroy.
With high duration audio file, if we open 10 times it will hang browser itself (then we need to either hard refresh or close browser itself to continue).
Steps to reproduce on linux:
1.open terminal type $htop 2.keep on opening audio with destroy on closing. 3.memory will keep on adding
Though i’m not a good programmer, but i have found a exact solution with canvas
and audio api
Here is that solution: https://stackoverflow.com/questions/53241345/web-audio-api-memory-leak?noredirect=1&lq=1
i request @katspaugh , please implement it as soon as possible.
Issue Analytics
- State:
- Created 3 years ago
- Comments:38 (8 by maintainers)
Top Results From Across the Web
wavesurfer.js destroy() causes Uncaught (in promise ...
Things appear to be working fine, but I get this error every time and I can't figure out what seems to be the...
Read more >Html5 Audio Buffer Keeps Increasing Js Heap Size - ADocLib
I have came across a issue with wavesurferjs it does not release memory previously held upon destroy. With high duration audio file if...
Read more >Untitled
#5 Xbox iphone no songs, Find income tax on 1040, #Saabkyle04 mitsubishi eclipse, Hey mom what's for dinner, Afiliacion afp obligatoria.
Read more >Bug listing with status RESOLVED with resolution UPSTREAM ...
Kernel panic: Attempted to kill init! with Dimension 8300 and P4 with Hyper Threading enabled" status:RESOLVED resolution:UPSTREAM severity:normal ...
Read more >HAR - River Thames Conditions
Without a trace season 1 episode 13, Dj tavi, Md 82903 universal remote control, Maarten van knippenberg, Fixed asset depreciation software small business, ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
AudioBuffer did not decrease in size and references to the buffers was being kept around even after all instances were destroyed after testing using multiple heap snapshots in Chrome.
On my end, I resolved this (before doing anything) by straight up deleting the buffer first.
delete this.wave.backend.buffer;
After the buffer is deleted, I run my regular destroying things like this.wave.destroy(); etc.
This solves the memory leak for me, which was upwards of 400mb every instantiation of a new object (using any of the recoemmdned backends).
Hello, I’ve been noticing this same issue on my end (Win 10, latest Chrome, latest Wavesurfer). I can confirm that Wavesurfer is erroneously not releasing the audio buffer after a call to
destroy()
, which results in the buffer not being garbage collected and persisting in memoryeven after subsequent calls to. This is most apparent when using large audio files. I know those MDN docs recommend short sound files but in practice on a decent machine Chrome handles larger audio files beautifully and I often work with tracks >1 hour in length as decoded buffers with the Web Audio API with no issues. If you set a variable holding an audio buffer toload()
different sound files using the same Wavesurfer instancenull
the memory is typically purged within seconds by the garbage collector. Therefore this is almost certainly not a Web Audio API/browser bug. Wavesurfer handles drawing large sounds beautifully too, but even after a call todestroy
I can see that there are still retained references to the buffer in the Wavesurfer object, preventing garbage collection. Simple example, go to https://wavesurfer-js.org/ and open the console:However even if I try manually
wavesurfer.backend.source.buffer = null
the buffer is still not garbage collected so I suspect there remains some reference to it even elsewhere in the Wavesurfer code that I haven’t figured out yet, perhaps you have an idea?And just as a demonstration here is simple vanilla Web Audio API code that loads a large audio file and then purges it when done, easily observable in Windows Task Manager: