I can't seem to figure out if my program has a memory leak or not. I've run various tools to look at it and I still don't know.
I'v run Valgrind on it and it reports a few kb of lost memory, but it doesn't seem to be from my code:
==21490== total heap usage: 18,651 allocs, 17,410 frees, 1,120,527,913 bytes allocated
==21490==
==21490== 76 bytes in 1 blocks are definitely lost in loss record 114 of 164
==21490== at 0x402911D: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==21490== by 0x461169D: ??? (in /usr/X11R6/lib/libGL.so.295.49)
==21490==
==21490== 124 bytes in 1 blocks are definitely lost in loss record 126 of 164
==21490== at 0x402911D: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==21490== by 0x47E1EC9: ??? (in /usr/lib/libxcb.so.1.1.0)
==21490== by 0x47E1F90: ??? (in /usr/lib/libxcb.so.1.1.0)
==21490== by 0x47E1812: xcb_connect_to_display_with_auth_info (in /usr/lib/libxcb.so.1.1.0)
==21490== by 0x47E1B1A: xcb_connect (in /usr/lib/libxcb.so.1.1.0)
==21490== by 0x44A8EE7: _XConnectXCB (in /usr/lib/libX11.so.6.3.0)
==21490== by 0x4498965: XOpenDisplay (in /usr/lib/libX11.so.6.3.0)
==21490== by 0x4C505F53: ???
==21490==
==21490== 524,264 bytes in 2 blocks are definitely lost in loss record 164 of 164
==21490== at 0x402911D: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==21490== by 0x46144BD: ??? (in /usr/X11R6/lib/libGL.so.295.49)
Also, when I look at my system monitor(KDE system monitor), it claims that my program is using a horrendous amount of memory(several hundred GB).
I'v also manually stepped through my program with a debugger and did not notice anything.
Accord to a Valgrind's Massif tool, it says my peak heap size is around 60mb.