Wednesday, 4 April 2007

And the Memory Leak Winner is …

Valgrind is a memory debugger, one of the big problems with large programs that run for any significant period of time is memory usage, a memory debugger allows a developer to diagnose where memory is being used, or lost due to programming error. Unfortunately many false negatives appear, or just fruity library calls that like leaving a mess exist, for example getprotobyname() generates this output:

==3068==  Address 0x51250B8 is 16 bytes inside a block of size 23 alloc'd
==3068==    at 0x4A2080E: malloc (vg_replace_malloc.c:149)
==3068==    by 0x400865F: (within /lib/ld-2.4.so)
==3068==    by 0x401119C: (within /lib/ld-2.4.so)
==3068==    by 0x400D1E5: (within /lib/ld-2.4.so)
==3068==    by 0x4010C0A: (within /lib/ld-2.4.so)
==3068==    by 0x4DC313F: (within /lib/libc-2.4.so)
==3068==    by 0x400D1E5: (within /lib/ld-2.4.so)
==3068==    by 0x4DC32A6: __libc_dlopen_mode (in /lib/libc-2.4.so)
==3068==    by 0x4D9F396: __nss_lookup_function (in /lib/libc-2.4.so)
==3068==    by 0x4D9F462: (within /lib/libc-2.4.so)
==3068==    by 0x4DA733B: getprotobyname_r (in /lib/libc-2.4.so)
==3068==    by 0x4DA70EF: getprotobyname (in /lib/libc-2.4.so)


Which gets repeated with slightly different numbers for all of one call :eek:

No comments:

Post a Comment