minor optimization of get_memory_stats()