I assume by "writing memory management routines" you mean dynamic storage allocation as in C - this is simply a matter of testing and discipline, even in bare C, and it's easier in C++ (but more prone to abuse). A decent C programmer never worries about leaks, because only a lazy sloppy gross oversight would produce one.