So, does anyone know a simple sound library that doesn't use a ton of RAM and can play midi files?
Yes, the JRE. Since Oracle Java 7 or OpenJDK anyway. These have Gervill built in (though you can ship it separately), which is an excellent MIDI / live DSP system. Just make sure you give it a decent soundbank to work with (which you may need to customize if you want to keep RAM usage down).
The bigger question is, why you want to do this? Note this message
and Cas' opinion (which I agree with). MIDI makes sense as a dynamic system, but not for playing static files.
Incidentally, if you go with Gervill, you'll also be in a position where you'll need to play your sound effects through it too - there was a discussion about this
In general, I'd suggest that unless you have very particular needs outlined in those links, stick with TinySound.
Does any OS actually manage the temp-dir in more more sophisticated ways than "shall I wipe it now, or shall I wipe it later" ?
Well, just clearing it on reboot is a good start on a desktop system (general Linux desktop with TMPFS or otherwise), then some do clearing up of files that haven't been accessed in a set amount of time.