In C++ or embedded development, how do you manage memory allocation to prevent leaks and ensure real-time performance?