[Fixed] [r3863] Fluidsynth: Soundfont memory leak

Bugs that have been investigated and resolved somehow.

Moderator: Developers

[r3863] Fluidsynth: Soundfont memory leak

Postby edward850 » Sat Sep 08, 2012 5:18 am

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.
User avatar
edward850
[netcode intensifies]
 
Joined: 19 Jul 2005
Location: New Zealand

Re: [r3863] Fluidsynth: Soundfont memory leak

Postby Gez » Sat Sep 08, 2012 5:35 am

I've encountered the same issue. Music stops playing and will only resume if the MIDI device is changed to a non-Fluidsynth one or if quitting and restarting ZDoom.
Gez
 
Joined: 06 Jul 2007

Re: [r3863] Fluidsynth: Soundfont memory leak

Postby Lars2500 » Sun Oct 21, 2012 4:34 pm

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.
Lars2500
 
Joined: 14 Jul 2012

Re: [r3863] Fluidsynth: Soundfont memory leak

Postby blackfish » Sat Oct 27, 2012 12:57 pm

Have you tried using BASSMIDI driver?
User avatar
blackfish
pew pew
 
Joined: 15 Jul 2003

Re: [r3863] Fluidsynth: Soundfont memory leak

Postby Lars2500 » Mon Oct 29, 2012 5:47 pm

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 4:26 am, edited 1 time in total.
Lars2500
 
Joined: 14 Jul 2012

Re: [r3863] Fluidsynth: Soundfont memory leak

Postby Enjay » Tue Oct 30, 2012 12:51 pm

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)?
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
Joined: 15 Jul 2003
Location: Scotland

Re: [r3863] Fluidsynth: Soundfont memory leak

Postby Lars2500 » Tue Oct 30, 2012 2:27 pm

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:
Lars2500
 
Joined: 14 Jul 2012

Re: [r3863] Fluidsynth: Soundfont memory leak

Postby Gez » Tue Oct 30, 2012 4:23 pm

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.
Gez
 
Joined: 06 Jul 2007

Re: [r3863] Fluidsynth: Soundfont memory leak

Postby Graf Zahl » Tue Oct 30, 2012 6:05 pm

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
Graf Zahl
 
Joined: 19 Jul 2003
Location: Germany

Re: [r3863] Fluidsynth: Soundfont memory leak

Postby randi » Tue Oct 30, 2012 9:58 pm

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
 
Joined: 09 Jul 2003

Re: [r3863] Fluidsynth: Soundfont memory leak

Postby randi » Tue Oct 30, 2012 10:56 pm

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 47 times
User avatar
randi
Site Admin
 
Joined: 09 Jul 2003

Re: [r3863] Fluidsynth: Soundfont memory leak

Postby edward850 » Wed Oct 31, 2012 12:58 am

That seems to fix it. Several map swaps and memory usage barely changed.
User avatar
edward850
[netcode intensifies]
 
Joined: 19 Jul 2005
Location: New Zealand

Re: [r3863] Fluidsynth: Soundfont memory leak

Postby Lars2500 » Wed Oct 31, 2012 4:28 am

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.
Lars2500
 
Joined: 14 Jul 2012

Re: [r3863] Fluidsynth: Soundfont memory leak

Postby Enjay » Wed Oct 31, 2012 12:36 pm

I've mirrored the file on the DRD ZDoom SVN build dowload page. Thank you.
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
Joined: 15 Jul 2003
Location: Scotland

Re: [r3863] Fluidsynth: Soundfont memory leak

Postby Gez » Thu Nov 01, 2012 3:52 am

This file should be updated too, since it is linked from the download page.
Gez
 
Joined: 06 Jul 2007


Return to Closed Bugs

Who is online

Users browsing this forum: No registered users and 1 guest