Memory leak with FMOD Studio Integration v2

Hi,

We discovered a memory leak in our game and after a lot of enabling/disabling came to the conclusion that the cause is something related to FMOD as there are no leaks if no calls are made to play anything. Here comes the peculiar part of the problem, there are no leaks if only PlayOneShot sounds are used and no leaks if only loop events are used, but when both one shots and loop events are active the leaks appear.

From what I could see using the FMOD memory profiler and Windows task manager it seems to be a bit of both. However, FMOD’s profiler doesn’t show any events with extremly long lifetimes and when I only enable the loop events there is no leak.

We are using Unity 5.3.4f1 Personal with FMOD Studio 1.07.06 with FMOD Studio Integration(v2) 1.07.06 and are driving all our sounds and music through FMOD.

(edit: Add more info on debugging so far)

Hi Victor, were you able to fix this problem you had by any chance? I think I’m having a similar issue when trying to run the game on the Windows Phone, both 8.1 and 10. I say ‘similar’ because the leak does not stop if I use only OneShots or Loops.

I’m no longer working actively on that game but I think the issue seemed to go away after they updated FMOD to a newer version. I say seemed as it is impossible to be 100% certain of it, but it improved so if it’s still leaking it’s much slower.

Can you clarify if this a managed memory leak, or a native memory leak?

After you stop your looping sounds you need to make sure you call EventInstace.release

Hi Nicholas, I added the answers to the question in order to keep all info together.

The profiler instance lifetime only shows the lifetime between start and stop, so it won’t show instance leaks caused by not calling EventInstance.release (that’s coming in the next major release).

Also be aware that Studio may be growing internal buffers that won’t be release until the system is shutdown.

Ok, do you know of any reason the leak only appears when using both PlayOneShot and loop events? Because to me it seems like the leak would still be present while using only loop events if it is not calling EventInstance.release.
Growing internal buffers seems like a good thing, but the leaks we see are in the range of 500MB RAM over the course of an hour or two, while the rest of the game uses ~500MB RAM.