How do you optimize mobile application performance, specifically regarding memory leaks and rendering lag?