Add logging of memory usage to error log on debug.