cancel
Showing results for 
Search instead for 
Did you mean: 

Memory problem with FMOD + Oculus Audio SDK plugin

samijtk
Level 2
Hi guys,

I encountered this curious problem with Fmod (1.09.05) equipped with Oculus Audio SDK (1.1.5).

The problem I encountered is as follows:
When I start my FMOD session, the program reserves 51 200 K of memory.
When I play a relatively complex sound from the session with 3D panner equipped, the total of 65 216 K of memory is reserved.
However, when I play much simpler sound with Oculus Spatializer equipped (Attenuation enabled, Reflections disabled), the total of 836 264 K of memory is reserved.

This effect is naturally forwarded to Unity project I'm working on. It also seems that the Unity doesn't take this into account when loading FMOD sound banks as the first sound that uses the Spatializer triggers the memory reservation, which in turn causes a definite lag spike in the runtime.

The most accurate cause for the problem that I can point out is a bigger merge we did in the project version control a while back. Naturally, none of the programs and plugins (OculusSpatializerFMOD.bundle for Unity excluded) are held in the version control so therefore they should be unharmed. After finding the source of the problem, I've re-installed the FMOD, its integration in Unity and Oculus Audio SDK plugins in both ends with no change.

Would you have some tips on how to fix this problem of mine? Until this problem manifested, I've been very happy using Oculus Audio SDK in our VR project and it would be a great pity to ditch it due to this relatively small but really annoying bug.
1 ACCEPTED SOLUTION

Accepted Solutions

Petroza
Level 7
The memory is allocated when our plugin is initialized. My guess is FMOD delays that until the sound is first played rather than preloading everything when loadPlugin is called or when the bank is loaded. You should be able to trigger that earlier by playing a silent sound, or even just creating an instance of the DSP plugin in code.

View solution in original post

3 REPLIES 3

Petroza
Level 7
Hi sam, thanks for the report. The spatializer does all the memory allocation up front to prevent run time memory allocations. It accounts for the worst case with maximum number of instances playing with long reflections and reverbs, we recently increased that limit to 128. The memory usage you're seeing is expected, but we recognize that 800MB is a lot of memory and we plan to improve this in the near future.

samijtk
Level 2
Hi imperativity and Peter and thank you for your answers. Your information is really helpful to understand what's going on. There remains but one thing that I don't yet understand.

Is Spatializer supposed to do the memory allocation upon the first sound activation? What I'm looking for is whether it is supposed to do its memory allocation when e.g. FMOD's soundbanks are loaded or is it completely independent?

This in itself is quite minor detail and I can always create a workaround where I just play some silent sound with Spatializer plugged in to trigger the memory allocation when suitable. Still, it would still be nice to know the alternatives if such exist.

Thanks guys for your time.

Petroza
Level 7
The memory is allocated when our plugin is initialized. My guess is FMOD delays that until the sound is first played rather than preloading everything when loadPlugin is called or when the bank is loaded. You should be able to trigger that earlier by playing a silent sound, or even just creating an instance of the DSP plugin in code.