How would you handle memory management and prevent memory leaks in resource-constrained C/C++ embedded environments?