Quick answer: FMOD Studio event instances leaking across plays? Stop fades the audio but keeps the handle alive. Call release() or attach the auto-release callback at creation.
Every gunshot creates an EventInstance; calling Stop on level change leaves all of them in memory. Hundreds accumulate per session.
Stop vs Release
Stop(FMOD_STUDIO_STOP_ALLOWFADEOUT) initiates a fade. The handle stays. release() frees the handle. Both are needed for short-lived events.
Auto-Release Pattern
instance->setCallback(callback, FMOD_STUDIO_EVENT_CALLBACK_STOPPED);
instance->start();
instance->release();
// release marks for cleanup when stopped naturallyRelease at start. FMOD handles the cleanup once playback ends — perfect for one-shots.
Persistent Loops
Looping events (music, ambience) keep their handle: don’t release. Store the handle for parameter updates and release on level unload.
Mass Cleanup
Track each issued handle in a vector. On scene unload, iterate and release. Catches the “one cleanup path missed” bug source.
Verifying
Memory profiler shows stable event-instance count across many plays. No accumulating Studio handles.
“FMOD instances need release. For one-shots, release at start with a stopped callback.”
Lots of FMOD games leak this way for years — release-at-start is the idiomatic pattern, but easy to miss in sample code.