I’m trying to understand when to call freeEventData

As a test, I set up all events to have a callback, and if the type was FMOD_EVENT_CALLBACKTYPE_EVENTFINISHED, I would get the event’s group, and call freeEventData only on that event, non-blocking. If it failed I would add the event to a list to re-attempt at the next frame update.

This seems very wrong, as I seem to trigger an infinite loop of calls in fmod and get a stack overflow.

What is the recommended way to do this?

The motivation for my (admittedly severe) test is that our memory usage seems to be higher than I would expect.

At first I was only calling freeEventData in our game when the user exited a level, but we found that during a level, mem usage (as reported by FMOD::Memory_GetStats( &currentAlloc, &maxAlloc ) ) was creeping higher and higher to the point that a 16MB block was not enough to make it through the level.

I would consider our sound needs "average" – we have an event that plays an ambient stream, a variety of events for music streams during encounters (fired at separate times, not simultaneously) and clips for short animation related sound fx and hud sounds.

I watched the memory usage before and after an "encounter". Audio-wise, an encounter will have a music stream that plays overtop the ambience, and perhaps a few dozen clip events that will be played repeatedly.
Before the encounter our current (and peak) memory was at around 7MB. Afterwards it was around 10MB. Does this sound reasonable?
It seemed like quite a jump to me.

note: the memory numbers are from our Xbox360 build, and the stack overflow on freeEventData was seen on both xbox and win32.

Any help would be much appreciated.

  • You must to post comments


I am quite interested in having an answer to these questions. In the documentation, it is not very clear what freeEventData really does. Does it free the data of the event instance passed as parameter or the data of the event itself ? The documentation isn’t really precise about events and events instances.

Anyway, when I’m done with an event instance, how can I free / release it ?

[ EDIT ]
And what about events retrieved with the FMOD_EVENT_INFOONLY flag ? Do I need to free them ?
[ /EDIT ]

Thank you,

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.