Threaded logging about to be merged

A heads-up: It looks good on my cluster, so I'll be merging the
threaded logging into master soon now. It took a while to find the
real problem but on the upside, I'm now pretty sure that there aren't
furhter leaks. :slight_smile:

Also, the code now automatically links to tcmalloc when it finds it.
At least on FreeBSD that not only helps with memory usage but also
significantly reduces CPU (and that even if no threads are used at