-1

I am running memcheck using valgrind. the o/p is

==3091== 204 bytes in 17 blocks are definitely lost in loss record 1,406 of 2,299

what does it mean ?

What I guess there is 204 bytes memory loss

but what it meant by

17 blocks ?

and how to know how many time this memory leak happened by same function ?

Complete stack trace of the valgrind

==3091== 204 bytes in 17 blocks are definitely lost in loss record 1,406 of 2,299
==3091==    at 0x4A05E1C: malloc (vg_replace_malloc.c:195)
==3091==    by 0x4CA304: fs_get (fs_unix.c:38)
==3091==    by 0x4E58C1: cpystr (misc.c:74)
==3091==    by 0x4D130F: ip_nametoaddr (ip_unix.c:178)
==3091==    by 0x4D15F4: tcp_open (tcp_unix.c:192)
==3091==    by 0x4D41A5: cc_connect_http_proxy (proxy.c:164)
==3091==    by 0x4D4B0C: cc_connect (proxy.c:571)
==3091==    by 0x4D506D: ssl_open (osdep.c:353)
==3091==    by 0x4E56C3: net_open_work (mail.c:6240)
==3091==    by 0x4E558A: net_open (mail.c:6196)
==3091==    by 0x4FBA04: imap_open (imap4r1.c:841)
==3091==    by 0x4D9CB1: mail_open_work (mail.c:1355)
Vivek Goel
  • 22,942
  • 29
  • 114
  • 186

1 Answers1

3

It means that there were 17 different calls to malloc (or another allocator function) whose return was not free'd. Those 17 allocations represented a total of 204 bytes being lost.

Mat
  • 202,337
  • 40
  • 393
  • 406
  • so the function which is calling malloc is only called one time right ?. as it is only one time. – Vivek Goel Jul 21 '11 at 05:31
  • I don't know your code, so I can't answer that comment. valgrind is telling you that 17 separate calls to allocator functions were made without a corresponding deallocation. – Mat Jul 21 '11 at 05:34
  • I updated my question with full stack trace. I am using c-client lib on it's function call it is showing that message. I am not sure is it one time memory leak or every time it is leaking . – Vivek Goel Jul 21 '11 at 05:38
  • That does not change a thing. That specific path in your code happened at least 17 times, and the allocations from that malloc were not freed 17 times. – Mat Jul 21 '11 at 05:40