[r3863] Fluidsynth: Soundfont memory leak

Bugs that have been investigated and resolved somehow.

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.
Post Reply
User avatar
edward850
Posts: 5886
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

[r3863] Fluidsynth: Soundfont memory leak

Post by edward850 »

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.
Gez
 
 
Posts: 17833
Joined: Fri Jul 06, 2007 3:22 pm

Re: [r3863] Fluidsynth: Soundfont memory leak

Post by Gez »

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.
Lars2500
Posts: 66
Joined: Sat Jul 14, 2012 8:45 am

Re: [r3863] Fluidsynth: Soundfont memory leak

Post by Lars2500 »

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.
User avatar
SyntherAugustus
Posts: 970
Joined: Tue Jul 15, 2003 5:43 pm

Re: [r3863] Fluidsynth: Soundfont memory leak

Post by SyntherAugustus »

Have you tried using BASSMIDI driver?
Lars2500
Posts: 66
Joined: Sat Jul 14, 2012 8:45 am

Re: [r3863] Fluidsynth: Soundfont memory leak

Post by Lars2500 »

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.
Last edited by Lars2500 on Wed Oct 31, 2012 3:26 am, edited 1 time in total.
User avatar
Enjay
 
 
Posts: 26517
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: [r3863] Fluidsynth: Soundfont memory leak

Post by Enjay »

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)?
Lars2500
Posts: 66
Joined: Sat Jul 14, 2012 8:45 am

Re: [r3863] Fluidsynth: Soundfont memory leak

Post by Lars2500 »

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)?
Probably because it's simply compiled differently? :wink:
Gez
 
 
Posts: 17833
Joined: Fri Jul 06, 2007 3:22 pm

Re: [r3863] Fluidsynth: Soundfont memory leak

Post by Gez »

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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [r3863] Fluidsynth: Soundfont memory leak

Post by Graf Zahl »

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.
User avatar
randi
Site Admin
Posts: 7746
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Re: [r3863] Fluidsynth: Soundfont memory leak

Post by randi »

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.
User avatar
randi
Site Admin
Posts: 7746
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Re: [r3863] Fluidsynth: Soundfont memory leak

Post by randi »

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
User avatar
edward850
Posts: 5886
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: [r3863] Fluidsynth: Soundfont memory leak

Post by edward850 »

That seems to fix it. Several map swaps and memory usage barely changed.
Lars2500
Posts: 66
Joined: Sat Jul 14, 2012 8:45 am

Re: [r3863] Fluidsynth: Soundfont memory leak

Post by Lars2500 »

Fantastic! :o Yes, the memory leak is fixed. I removed the link to the alternate dll from my post as it's no longer needed.
User avatar
Enjay
 
 
Posts: 26517
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: [r3863] Fluidsynth: Soundfont memory leak

Post by Enjay »

I've mirrored the file on the DRD ZDoom SVN build dowload page. Thank you.
Gez
 
 
Posts: 17833
Joined: Fri Jul 06, 2007 3:22 pm

Re: [r3863] Fluidsynth: Soundfont memory leak

Post by Gez »

This file should be updated too, since it is linked from the download page.
Post Reply

Return to “Closed Bugs [GZDoom]”