one of most basic things you could do is always check the memory usage (when prog is running) from system monitor(linux top command) ,windows task manager or other tools
If you find the memory usage is always increasing as the execution of prog proceeds, it may have a leak.
Here you can use tools like valgrind this link explains commands valgrid uses & other basics of valgrind (
http://cs.ecs.baylor.edu/~donahoo/tools/valgrind/)