Detecting Memory leaks

commandline session

$valgrind --tool=memcheck --leak-check=full ./a.out
==6002== Memcheck, a memory error detector
==6002== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==6002== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==6002== Command: ./a.out
==6002==
-31
0
1
2
2
4
100
83
99
782
==6002==
==6002== HEAP SUMMARY:
==6002==     in use at exit: 0 bytes in 0 blocks
==6002==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==6002==
==6002== All heap blocks were freed -- no leaks are possible
==6002==
==6002== For counts of detected and suppressed errors, rerun with: -v
==6002== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)
$