Code, man! Show us some code!
gdb (the Gnu DeBugger) is an excellent tool, as mentioned by acid_kewpie. An alternative could be Valgrind:
Valgrind is really good. It runs your application in a sandbox environment and tells you exactly where and when you write to unallocated memory or forget to delete memory. It currently only runs on x86-processors, though.