Optimize memory.