Memory logging is toggleable, and does not open/close log file with every entry.
Merge pull request #167 from rdnelson/memlog_hang_fix

Improved memory logging.