I have an application that only play a mp3. I check all fmod function return code. I tried in debug and I have random bug, always located in the fmod lib.

I tried it on windows XP, mac 10.5 and ubuntu and I have random crash on the 3 OS.

– sometimes it generates pure function call and crash visual studio
– sometimes it’s Access violation reading location 0x00000000. (or other address)


this is the report that happen sometimes when i release the fmod system:

Exception Codes: 0x000000000000000d, 0x000000000000615c
Crashed Thread: 0
Thread 0 Crashed:
0 ??? 0x1796dfe6 0 + 395763686
1 libfmodex.dylib 0x00a6f9c8 FMOD::SystemI::createFile(FMOD::File**, bool) + 1442
2 libfmodex.dylib 0x00a753c3 FMOD::SystemI::createFile(FMOD::File**, bool) + 24477
3 libfmodex.dylib 0x00a6b373 FMOD::System::update() + 39

using valgrind I have that:

==6372== Invalid read of size 4
==6372== at 0x408F50A: FMOD::ChannelI::stopEx(bool, bool, bool, bool, bool, bool, bool) (in /home/cvs/external/fmodex/api/lib/libfmodex.so.4.10.04)
==6372== Address 0x6B23754 is 108 bytes inside a block of size 212 free’d
==6372== at 0x402237F: free (vg_replace_malloc.c:233)
==6372== by 0x40CD164: FMOD_OS_Memory_Free(void*) (in /home/cvs/external/fmodex/api/lib/libfmodex.so.4.10.04)

Seems that stopEx try to access to a freed block.

  • You must to post comments

are you callng fmod functions from different threads? It does not read memory that is freed without something on the outside causing it to happen.

  • You must to post comments

I perhaps found the issue.

I play a list of mp3 stream. So i create the stream, add a callback to detect the end of the mp3 and then play the stream.
Inside the callback, i release the stream like that:

static FMOD_RESULT F_CALLBACK MusicEndCallback(FMOD_CHANNEL *channel, FMOD_CHANNEL_CALLBACKTYPE type, int command, unsigned int commanddata1, unsigned int commanddata2)
// remove the callback
MusicChannel->setCallback(FMOD_CHANNEL_CALLBACKTYPE_END, 0, 0);
// stop the music
// release the sound
return FMOD_OK;

then, i create a new stream, add the callaback to detect the end of the mp3 and goto 1;

Is it a good way to release a stream and all sound buffer?
Is it good to stop the music and release the sound inside the callback?

I don’t use any thread.

  • You must to post comments

That will be it.
4.10.04/4.11.04 actually had this entry

  • Stop user being able to release a sound that was already in the middle of
    being released from a channel callback (Sound::release calls channel callback)

This might help you, but you are doing alot more than that.
I would suggest setting a flag in the callback, then executing that code in the main loop after system::init instead.

Then you should be fine.

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.