Added memory logging.