[r3863] Fluidsynth: Soundfont memory leak
Moderator: GZDoom Developers
Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
[r3863] Fluidsynth: Soundfont memory leak
When using Fluidsynth, soundfonts seem to get loaded each time the music changes, but the old one is still held in memory. This fills the available memory within as much as 4 song changes with a 200MB soundfont.
Also, the error when Fluidsynth fails to load a soundfont when there isn't enough memory available is a somewhat misleading "Failed to load any MIDI patches" message.
Also, the error when Fluidsynth fails to load a soundfont when there isn't enough memory available is a somewhat misleading "Failed to load any MIDI patches" message.
Re: [r3863] Fluidsynth: Soundfont memory leak
I've encountered the same issue. Music stops playing and will only resume if the [wiki]MIDI device[/wiki] is changed to a non-Fluidsynth one or if quitting and restarting ZDoom.
Re: [r3863] Fluidsynth: Soundfont memory leak
This is really nasty. Any chance of seeing this fixed in the near future? I too ran into this bug though I did not relate it to the Fluidsynth code but rather to the sound font used, and that will probably happen to others, too.
- SyntherAugustus
- Posts: 970
- Joined: Tue Jul 15, 2003 5:43 pm
Re: [r3863] Fluidsynth: Soundfont memory leak
Have you tried using BASSMIDI driver?
Re: [r3863] Fluidsynth: Soundfont memory leak
I did some further testing and found that the memory leak seems to be present in Randy's compiled fluidsynth.dll, not the ZDoom code.
There is a compiled fluidsynth dll out on the net that works flawlessly with ZDoom, does not have the memory leak and is based on the latest FluidSynth version 1.1.6. I found it in a program called jOrgan.
There is a compiled fluidsynth dll out on the net that works flawlessly with ZDoom, does not have the memory leak and is based on the latest FluidSynth version 1.1.6. I found it in a program called jOrgan.
Last edited by Lars2500 on Wed Oct 31, 2012 3:26 am, edited 1 time in total.
Re: [r3863] Fluidsynth: Soundfont memory leak
Do you know why it needs libglib-2.0-0.dll and libgthread-2.0-0.dll as well when Randy's one only needs fluidsynth.dll (which is also smaller than the one from the jOrgan program)?
Re: [r3863] Fluidsynth: Soundfont memory leak
Probably because it's simply compiled differently?Enjay wrote:Do you know why it needs libglib-2.0-0.dll and libgthread-2.0-0.dll as well when Randy's one only needs fluidsynth.dll (which is also smaller than the one from the jOrgan program)?
Re: [r3863] Fluidsynth: Soundfont memory leak
Randy managed to get them to link statically I suppose. If he wants to share his secrets on the topic, I know several people who would be interested.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49056
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: [r3863] Fluidsynth: Soundfont memory leak
I guess that's an efficient compiler (MSVC) versus an inefficient one (gcc).
I have seen it quite often that GCC produces significantly larger binaries, especially when using C++ exceptions. The exception code in there is a lot more complex because it completely sidesteps Windows's exception mechanisms and rolls out its own implementation that also needs to include everything that's normally done by the system itself.
I have seen it quite often that GCC produces significantly larger binaries, especially when using C++ exceptions. The exception code in there is a lot more complex because it completely sidesteps Windows's exception mechanisms and rolls out its own implementation that also needs to include everything that's normally done by the system itself.
Re: [r3863] Fluidsynth: Soundfont memory leak
My "secrets" are that I had to muck about in config file and Makefiles and track down dependencies. It was a pain in the butt. Not so much building Fluidsynth as building glib.
Also, using a libintl replacement that uses the built-in Windows functions instead GNU's libintl saved a lot of space.
Also, using a libintl replacement that uses the built-in Windows functions instead GNU's libintl saved a lot of space.
Re: [r3863] Fluidsynth: Soundfont memory leak
Here, I made a new build. This time with fluidsynth 1.1.6 instead of 1.1.1. Watching memory usage in task manager, it seems fine. Would anyone care to confirm?
- Attachments
-
- fluidsynth.7z
- (267.08 KiB) Downloaded 84 times
Re: [r3863] Fluidsynth: Soundfont memory leak
That seems to fix it. Several map swaps and memory usage barely changed.
Re: [r3863] Fluidsynth: Soundfont memory leak
Fantastic! Yes, the memory leak is fixed. I removed the link to the alternate dll from my post as it's no longer needed.
Re: [r3863] Fluidsynth: Soundfont memory leak
I've mirrored the file on the DRD ZDoom SVN build dowload page. Thank you.
Re: [r3863] Fluidsynth: Soundfont memory leak
This file should be updated too, since it is linked from the download page.