FMOD debug library: corrupted memory with FMOD_ErrorString and exceptions?

Hi all,

I have no idea if this is a bug in my code or a bug in FMOD. But in my project (which to be clear does a lot of things in it’s scene constructor and update functions), FMOD error strings consistently get corrupted on the MSVC CRT heap. As in, the entire exception message is somehow being deallocated when the exception is thrown but before it’s caught by main. I feel like this is a potential FMOD bug because, although it doesn’t happen when I simulate a fake error condition and display a message box, it does happen when I signal to SDL3 that a critical error has occurred (and obviously 99 percent of FMOD errors are crit) by throwing an exception. The only multi-threaded library besides FMOD that I’m using is JoltPhysics, but none of this exception handling is Jolt-related but FMOD related, and none of it occurs across a thread boundary. I have never seen anything like this happen before, and my attempts to figure out why exactly it’s happening have so far completely failed. Granted, my constructor does do a lot, but even if I move out a bunch of the code into smaller functions it still happens, and it even happens in my update loop which is considerably smaller than my constructor is. Hence why I believe this to be something going on with FMOD. I am using the FMOD debug library in debug releases, if that matters.

Has anyone experienced this before? If so, how did you fix it? I’ve managed to hack around it by littering my code with calls to OutputDebugString, but this is non-portable and I’d like to not depend on it as a long-term solution. I could use the FMOD error callback, but I would lose error context.

Update: so this apparently is not just happening when I use FMOD_ErrorString, but with exceptions I throw in my scene manager too… So obviously this is (not) an FMOD problem I think? It’s really hard to tell and I honestly have struggled a lot to figure out what the problem is. And linters aren’t really helping. Will mark this as resolved since this isn’t an FMOD issue.

1 Like