How did I live without valgrind? It so useful!
To be honest I am very careful with coding and rarely hit memory leaks. My background has been in embedded software which means being very careful.
However, we had a memory leak in the call handling code. Not serious, and picked up by our monitoring anyway. Just using up a few bytes every now and then so that after some days you could see it was using noticeably more memory.
Buggered if I can find it, so (at Cliff's suggestion) I tried valgrind. It is already installed on the machine as standard it seems. All I had to do was run the app with valgrind on the start of the command line; leave it a few seconds to "leak" a bit; stop it; and valgrind says where the leak is. It could not be simpler to use...
Knowing where to look - it was, of course, blindingly obvious. An exception case did not free something, but that was happening every time an authenticated SIP request came in.
So +1 for valgrind. Well worth using if you have any suspicion that you have a memory leak in your code. Very cool.
P.S. Apologies to my sister-in-law and other non-techies as this will have made no sense whatsoever and I really could not find a way to explain it in simpler terms, so didn't even try... :-)