EventInstance.release() is not working. MEMORY: cur just keeps building up and never goes down throughout the runtime of the app… and max keeps going up and doesn’t go down ever.
Now I notice that when I play the sample in FMOD Studio the playback goes from “PLAYING” to “STOPPING” but never reaches “STOPPED” … I was under the impression that it would go to stopping automatically as the sample finishes?
Do I need to set some stop flag in FMOD Studio? Where do I do that?
No, the memory leak persists for another event that does stop after playing (set up differently than the one in the pic above) … even though I call .release() on the instance after it is started the memory usage goes up and up… so it seems the events are never destroyed/disabled/ etc. After about ten minutes of playing on mobile the sound starts cracking because of memory overload.
Can somebody please help me, or is this forum not active?
Do you have an AHDSR modulator with a long release on the master fader? That’s the only way I would think the Event would stay on “Stopping”. At least I can see there is something still acting on the master fader in your screenshot. You could call Studio::EventInstance::stop with FMOD_STUDIO_STOP_IMMEDIATE before releasing if you want the event instance to stop immediately without waiting for AHDSR modulators.
Releasing an event only occurs once an event instance has come to a complete stop. If you are not calling an immediate stop on an event, instead allowing for fade out, then it will wait until the event instance has finished the “STOPPING” playback state and entered the “STOPPED” playback state.
There is something that is preventing your event from stopping properly. Check for the following:
Make sure the event macro is not set to Persistent
Make sure there are no loop regions, transition regions, or sustain points in the event
If possible, please show a screenshot of the entire event for us to look at if you are still having issues.
This is the whole screen shot of the event that doesn’t stop, but that doesn’t seem to be the problem though as I have looked further into it… Even if I use another event that does stop as soon as the sample is over (The Bell event), the FMOD memory debug display in Unity just goes up and up and never goes down. … Play the game (in an android build) for about 10 minutes (only using the Bell event) and the sound starts crackling.
I am using ADSHR on some events, including the bell that stops fine (but still causes a memory leak in Unity), but not the other one, BassDrone, (which also causes a memory leak but doesn’t stop).
‘Persistent’ isn’t on, and there are no loop regions, transition regions, or sustain points in the event
It sounds like there is definitely something in your event that is preventing you from stopping with fade out. Are you able to copy this event to a new project and to send it over to look at? You can send it over to support@fmod.com or DM me.
It turns out that the Oculus Spatial Reverb is not going idle. So whilst the event is “stopped” and no audio is playing, the Oculus Spatial Reverb effect is keeping the event alive in the “stopping” state. It is odd that this happens with some events but not others, but it is definitely the reverb effect that is causing this. You will need to bring this up with the Oculus developers to fix in a future update.
There is a workaround which is to move the Oculus Spatial Reverb effect to a return bus and use a send effect. This will allow the event to stop naturally and the reverb to play out.