Added memory usage logging.