On OSX, when I call Sound::Release after releasing FMOD Studio sound system, the app deadlocks.
Because the destruction order of static objects is arbitrary, it can happen that the sound objects instances are destroyed after the FMOD Studio Sound system instance.
In that case, the sound::release blocks forever.
- c0diq asked 3 years ago
What is the Sound:release method for? How do I release sounds I don’t need anymore when I need to regain memory?
Or are you saying I should not have to call Sound:release if the SoundSystem has been destroyed because it would have released the sounds for me then?
- c0diq answered 3 years ago
Yes, that’s exactly what he’s saying. The FMOD::System object owns the memory for the FMOD::Sound objects, so if you call System::release(), it’ll free up all of its memory. If you try to call Sound::release() after calling System::release(), you’re basically trying to call a function on a dangling pointer. You should not call any methods on any FMOD objects after releasing your System object.
The Sound::release() function is so that you can do some memory management yourself without having to unload the whole system. Maybe you’re loading into a new scene and you need a whole different set of sounds – all of the old sounds that aren’t referenced by the game anymore can safely be release()ed.
Hope that helps!
- Adiss answered 3 years ago
Please login first to submit.