Playing Multiple Sounds Memory Leak

So, i just noticed that (im just guessing it's a bug?) playing a lot of sounds takes up memory even stopping it, I played about 150 sounds in a script then i stopped it:
image
I checked in task manager and i saw that it took up about like 1.2 GB of RAM, It still is like that when all sounds are stopped, even opening a new project, To fix this, i need to reload the page, Also i tried this on javascript terminal and it took up like 10 MB of RAM (i used the .pause() function on audios), i wonder whys that? Why cant Snap ! just simply delete the audio memory after it stops? just wondering, Can it be improved?

(also yeah im back after many months of not creating a new topic)

Hi, welcome home. :~)

I think we know about this.

Hello bh!

If you guys know the issue then... Is there any way how to fix the issue?

This is an issue for looping long music or playing short sounds thousand and thousands of times for a long time in Snap! (you leave your computer for many hours and then the memory goes up)
Also i noticed that the sound gets a bit glitchy, Like the audio cuts off sometimes when you play a lot of it, I don't know if its my Computer or its the Browser doing that audio issue (im using Chrome, Windows 10)

I'm not very good in JavaScript but im pretty sure that can be fixed, right?

Yeah, it'll get fixed, people are looking into it. Apparently it's not trivial.

Is the issue that you're using untitled script pic - 2023-04-23T132150.822 instead of untitled script pic - 2023-04-23T132202.730 ? I only run into a memory issue when I start a bunch of sounds at once, like with
untitled script pic - 2023-04-23T132257.050
However, I don't run into a memory issue with
untitled script pic - 2023-04-23T132326.998

Check the developer tools and find the Performance Monitor tab. RAM goes up as sounds are being played. The reason it doesn't "appear" is because you're starting sounds and waiting for them to end, and then starting the sound again, which is much slower than starting a ton of sounds and continuing on without waiting for them to end.

Yes. They are starting 150 instances of a sound that is well over two minutes long. This is going to cause a massive uptick in RAM usage. If the sound is background music, it is likely better to use play-sound-until-done.

I think this also applies to the play note block, if I play a lot of them it gets really laggy