From f3313cc78e637ec9bc11efce5eb943434da93416 Mon Sep 17 00:00:00 2001 From: "Tim E. Real" Date: Mon, 3 Oct 2011 01:56:34 +0000 Subject: Fixed HUGE massive memory leaks in all things using CItemList, and SndFile, dssi, fluidsynth and other huge leaks. Large song with several dssi, vst, fluidsynths leaked 100's of MB, now only ~2MB. --- muse2/synti/fluidsynth/fluidsynti.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'muse2/synti') diff --git a/muse2/synti/fluidsynth/fluidsynti.cpp b/muse2/synti/fluidsynth/fluidsynti.cpp index a03c5da8..cc5c496a 100644 --- a/muse2/synti/fluidsynth/fluidsynti.cpp +++ b/muse2/synti/fluidsynth/fluidsynti.cpp @@ -115,6 +115,17 @@ FluidSynth::FluidSynth(int sr, pthread_mutex_t *_Globalsfloader_mutex) : Mess(2) FluidSynth::~FluidSynth() { + + for (std::list::iterator it =stack.begin(); it !=stack.end(); it++) + { + if(it->intid == FS_UNSPECIFIED_FONT || it->intid == FS_UNSPECIFIED_ID) + continue; + //Try to unload soundfont + int err = fluid_synth_sfunload(fluidsynth, it->intid, 0); + if(err == -1) + std::cerr << DEBUG_ARGS << "Error unloading soundfont!" << fluid_synth_error(fluidsynth) << std::endl; + } + int err = delete_fluid_synth (fluidsynth); if(gui) delete gui; -- cgit v1.2.3