howler.js icon indicating copy to clipboard operation
howler.js copied to clipboard

Performance issues with Howl().play() creating Event Leaks?

Open h3rb opened this issue 4 years ago • 7 comments

I'm getting Event Leaks related to howler.js

I have been trying to chase down an Event Handler Leak (parabolic creation of Listeners)

Steps to reproduce:

  1. Download https://github.com/LAGameStudio/lawg

  2. On a local machine, load index.html into Chrome

  3. Open developer tools

  4. Start profiler (under Performance)

  5. Refresh page after 2 seconds (arbitrarily)

  6. Don't shoot for a number of seconds (mental note)

  7. Shoot one bullet, wait 5 seconds, shoot 2 bullets -- this is done with CTRL key

You can see that the number of listeners created by Howler is crazy huge, like 207 for one or just a few played sounds in one test I performed. I'm tracking down other issues perhaps (the performance decreases readily) but I noticed this huge number of listeners...

Maybe i'm crazy

h3rb avatar Dec 11 '20 22:12 h3rb

I personally also experience memory leaks when using howler, but not sure if that's the exact cause

richiedevs avatar Jan 02 '21 02:01 richiedevs

Yeah this is still unresolved on my end. Even with memory pooling the performance lags in chrome. If I resize the browser window slightly, it then does GC and everything is fine.

h3rb avatar Jan 03 '21 03:01 h3rb

Does anyone have a simpler test case of the event listener build up? I've done some testing on the included howler examples and am not seeing an issue so far.

goldfire avatar Jun 13 '21 21:06 goldfire

I believe it's an issue with the way Chromium handles Audio. Since it can be easily reproduced by just playing songs, and skipping them, I've personally managed to handle this memory leak quite well, by switching to html5 audio instead, less increase in memory, but still some kind of increase, quite of a strange bug.

richiedevs avatar Jun 13 '21 23:06 richiedevs

I'll do some investigation tomorrow and see if I also get those huge amounts of listeners like h3rb said

richiedevs avatar Jun 13 '21 23:06 richiedevs

Any updates here? Seeing similar behavior.

epleaner avatar Aug 14 '23 17:08 epleaner

I also experience memory leaks when using howler. Loading new audio after another creates leaks over 1gb

ExLineP avatar Nov 30 '23 20:11 ExLineP