I once had to intercept every call malloc/free/realloc and log it to find a leak. I wound up turning that into an immensely useful tool.
Over time, though, it got less and less effective, as I got better and better at avoiding writing such bugs in the first place.
Most bugs I create these days are due to misunderstanding the problem I'm solving, rather than memory misuse.
also there should be an HN comments award show or something
[0] - https://en.wikipedia.org/wiki/Valgrind
[1] - https://en.wikipedia.org/wiki/Julian_Seward