valgrind
Good pdf:
https://aleksander.es/data/valgrind-memcheck.pdf
FAQ:
http://valgrind.org/docs/manual/faq.html#faq.deflost
Useful link:
http://blog.51cto.com/zhenhua2000/768342
http://blog.csdn.net/spch2008/article/details/51375407
https://www.cnblogs.com/cobbliu/p/4423775.html
http://blog.chinaunix.net/uid-23629988-id-3033741.html
Souce code:
http://valgrind.org/downloads/current.html
example:
$ sudo apt-get install valgrind
$ valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --log-file=valgrind.log -v ./video_encode decompressed.yuv 1920 1080 H264 ./out.h264 -fps 1 1