Sound instances that use the same large sounds leak Streaming Sounds memory on the server

  • Describe the bug. Describe what is happening when the bug occurs. Describe what you would normally expect to occur.

Whenever we create a new sound instance with a large sound as its SoundId, or set the SoundId of a sound to a large sound, memory gets allocated on the server with tag Streaming Sounds that never gets deallocated. This is true even if the same sound asset has been used before.

I would expect it to do one of two things: either

  • deallocate the memory once the sound is destroyed or the SoundId is changed away from the current sound
  • only allocate memory once for a given sound asset so that eventually, once all of the game’s sounds are loaded in, the server memory would stop accumulating

It’s a fairly big, hard-to-work around problem for us. Every time we spawn a vehicle we need to attach engine, tire, road sounds that are fairly big, and we’re seeing a large leak every time.

  • How often does the bug happen (Everytime/sometimes/rarely)? What are the steps that reproduce the bug? Please list them in very high detail. Provide simple example places that exhibit the bug and provide description of what you believe should be the behavior.

It happens every time.
I’ve provided this uncopylocked place to demonstrate:

There are a variety of ways to reproduce the leak here; the script that is currently enabled, PeriodicLeakFromChangingSoundId, changes the sound id back and forth between two sounds.
Use F9 and the server memory tab to watch the Streaming Sounds server memory usage.

You could disable that script and enable one of these others to see other ways to repro it:
PeriodicLeakFromCloningSound clones a part from serverstorage and then destroys it. Every time it does there is a leak.
PeriodicLeakFromNewInstance does the same thing with

  • When did the bug start happening? If we can tie it to a specific release that helps us figure out what we broke.

As far as I know it has been broken for a while. It looks like the author of this post experienced it: Memory Leak Issue
It’s even possible that this user was seeing the same thing, from 2014:
Memory leak with sounds

  • Anything else that you would want to know about the bug if it were your job to find and fix it.

PS - this is a server bug and not a client bug, so I wasn’t sure where to file the report since there doesn’t seem to be a ‘server bugs’ section.


I suspect that this is related to

and will be also fixed when that other bug’s fix is released.

A fix for this issue is in progress. Thanks for the bug report!