I’m using custom memory allocators and I have noticed that there seems to be a memory leak. As I understand it you do not have to do anything to channel and sound handles as they will be automatically released when you call system::release, but this does not appear to be the case. To verify this I simply put in a counter for number of times malloc was called versus free, and there are clearly more mallocs than free after calling release on fmod system after playing a few sfxs and streaming a single music track.
If I setup the code such that I keep pointers to all sound objects and then call release on them manually before shutting down FMOD the count magically goes to zero as it should.
Am I missing something here? Thanks
- mac_bug asked 10 years ago
But this is what it says in the doc
Call System::release to close the output device and free all memory associated with that object.
Channels are stopped, and sounds are released. [b:j3mvlmja]You do not have to stop channels yourself, or free sounds if you call this.[/b:j3mvlmja]
You can of course do it if you want, it is just redundant, but releasing sounds is good programming practice anyway.
You do not have to call System::close if you are releasing the system object. System::release internally calls System::close anyway. [/quote:j3mvlmja]
Hrm, you’re right. The docs might be wrong, then. We’ve always explicitly release()d our sounds.
If you don’t store off pointers to your Sounds, you can probably write a function real quick to iterate over the Mater Sound Group and release them all through there.
Well ok that’s what I figured, I was just wondering why FMOD doesn’t free these sound handles itself any more on shutdown since you can’t do anything with the sound handles after the fact, in addition from the documentation it is suggesting that all sound handles by default goes to the master sound group, so if I could just access them there and release them, why can’t FMOD do it for me?
I went through the master sound group and freed them in reverse order but i’m still missing half of the memory, hmmm[/edit]
Please login first to submit.