0
0

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

  • You must to post comments
0
0

You don’t have to clean up Channels, but you are supposed to call release() on all of your Sounds before you shut down.

  • You must to post comments
0
0

But this is what it says in the doc :(

[quote:j3mvlmja]Shutdown.
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]

  • You must to post comments
0
0

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.

  • You must to post comments
0
0

Hi,
looks like you do need to release your sounds and the docs need updating.

  • You must to post comments
0
0

What if I were to create the sounds with OPENMEMORYPOINT ? Can I then ignore sound pointers and not free them, as long as I free the array I allocated and passed in myself?

  • You must to post comments
0
0

fmod still creates the FMOD::Sound handle to use so no you can’t just ignore it, but it obviously doesn’t try to free your memory – that’s what the _POINT option is for.

  • You must to post comments
0
0

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?

[edit]I went through the master sound group and freed them in reverse order but i’m still missing half of the memory, hmmm[/edit]

  • You must to post comments
Showing 7 results
Your Answer

Please first to submit.