1

I've been getting this error whenever i run a full valgrind memory leak check and I really can't tell where the source of this error is. My code is running and appears to be correct but i've been getting this error since. Any advice would be much appreciated, thank you!

==2312== HEAP SUMMARY:
==2312==     in use at exit: 26,325 bytes in 190 blocks
==2312==   total heap usage: 20,531 allocs, 20,341 frees, 197,089 bytes allocated
==2312== 
==2312== Searching for pointers to 190 not-freed blocks
==2312== Checked 9,805,752 bytes
==2312== 
==2312== 272 (80 direct, 192 indirect) bytes in 1 blocks are definitely lost in loss record 53 of 67
==2312==    at 0x100009EBB: malloc (in /usr/local/Cellar/valgrind/3.11.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2312==    by 0x1001C44A2: __Balloc_D2A (in /usr/lib/system/libsystem_c.dylib)
==2312==    by 0x1001C4DEB: __d2b_D2A (in /usr/lib/system/libsystem_c.dylib)
==2312==    by 0x1001C1443: __dtoa (in /usr/lib/system/libsystem_c.dylib)
==2312==    by 0x1001EA07A: __vfprintf (in /usr/lib/system/libsystem_c.dylib)
==2312==    by 0x10021335C: __v2printf (in /usr/lib/system/libsystem_c.dylib)
==2312==    by 0x1001E901D: vfprintf_l (in /usr/lib/system/libsystem_c.dylib)
==2312==    by 0x1001E6EB7: printf (in /usr/lib/system/libsystem_c.dylib)
==2312==    by 0x100001B02: main (in ./tldmonitor)
==2312== 
==2312== LEAK SUMMARY:
==2312==    definitely lost: 80 bytes in 1 blocks
==2312==    indirectly lost: 192 bytes in 5 blocks
==2312==      possibly lost: 0 bytes in 0 blocks
==2312==    still reachable: 0 bytes in 0 blocks
==2312==         suppressed: 26,053 bytes in 184 blocks
==2312== 
==2312== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 16 from 16)
--2312-- 
--2312-- used_suppression:      1 OSX1011:21-Leak /usr/local/Cellar/valgrind/3.11.0/lib/valgrind/default.supp:944 suppressed: 4,096 bytes in 1 blocks
--2312-- used_suppression:      1 OSX1011:15-Leak /usr/local/Cellar/valgrind/3.11.0/lib/valgrind/default.supp:886 suppressed: 4,096 bytes in 1 blocks
--2312-- used_suppression:     10 OSX1011:17-Leak /usr/local/Cellar/valgrind/3.11.0/lib/valgrind/default.supp:906 suppressed: 3,392 bytes in 55 blocks
--2312-- used_suppression:      3 OSX1011:16-Leak /usr/local/Cellar/valgrind/3.11.0/lib/valgrind/default.supp:897 suppressed: 2,816 bytes in 44 blocks
--2312-- used_suppression:      2 OSX1011:4-Leak /usr/local/Cellar/valgrind/3.11.0/lib/valgrind/default.supp:778 suppressed: 4,152 bytes in 2 blocks
--2312-- used_suppression:      2 OSX1011:19-Leak /usr/local/Cellar/valgrind/3.11.0/lib/valgrind/default.supp:924 suppressed: 2,592 bytes in 2 blocks
--2312-- used_suppression:      7 OSX1011:7-Leak /usr/local/Cellar/valgrind/3.11.0/lib/valgrind/default.supp:808 suppressed: 1,680 bytes in 22 blocks
--2312-- used_suppression:     11 OSX1011:18-Leak /usr/local/Cellar/valgrind/3.11.0/lib/valgrind/default.supp:915 suppressed: 2,312 bytes in 11 blocks
--2312-- used_suppression:     20 OSX1011:10-Leak /usr/local/Cellar/valgrind/3.11.0/lib/valgrind/default.supp:839 suppressed: 2,461 bytes in 39 blocks
--2312-- used_suppression:      2 OSX1011:8-Leak /usr/local/Cellar/valgrind/3.11.0/lib/valgrind/default.supp:819 suppressed: 520 bytes in 2 blocks
--2312-- used_suppression:      2 OSX1011:20-Leak /usr/local/Cellar/valgrind/3.11.0/lib/valgrind/default.supp:934 suppressed: 224 bytes in 5 blocks
==2312== 
==2312== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 16 from 16)

After i generate a suppression block:

==2317== HEAP SUMMARY:
==2317==     in use at exit: 26,325 bytes in 190 blocks
==2317==   total heap usage: 20,531 allocs, 20,341 frees, 197,089 bytes allocated
==2317== 
==2317== Searching for pointers to 190 not-freed blocks
==2317== Checked 9,805,752 bytes
==2317== 
==2317== 272 (80 direct, 192 indirect) bytes in 1 blocks are definitely lost in loss record 53 of 67
==2317==    at 0x100009EBB: malloc (in /usr/local/Cellar/valgrind/3.11.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2317==    by 0x1001C44A2: __Balloc_D2A (in /usr/lib/system/libsystem_c.dylib)
==2317==    by 0x1001C4DEB: __d2b_D2A (in /usr/lib/system/libsystem_c.dylib)
==2317==    by 0x1001C1443: __dtoa (in /usr/lib/system/libsystem_c.dylib)
==2317==    by 0x1001EA07A: __vfprintf (in /usr/lib/system/libsystem_c.dylib)
==2317==    by 0x10021335C: __v2printf (in /usr/lib/system/libsystem_c.dylib)
==2317==    by 0x1001E901D: vfprintf_l (in /usr/lib/system/libsystem_c.dylib)
==2317==    by 0x1001E6EB7: printf (in /usr/lib/system/libsystem_c.dylib)
==2317==    by 0x100001B02: main (in ./tldmonitor)
==2317== 
==2317== 
alk
  • 69,737
  • 10
  • 105
  • 255
user1610834
  • 115
  • 2
  • 13
  • 1
    Possible duplicate of [User Leak, libc++ leak or false positive](http://stackoverflow.com/questions/29442597/user-leak-libc-leak-or-false-positive) – Dark Falcon Oct 28 '15 at 13:46
  • Is this a false leak? I cannot seem to trace the problem at all in my code. – user1610834 Oct 28 '15 at 13:54
  • If you don't show us your code. ... is not that easy to understand everything from there. Use also **valgrind --leak-check=full --track-origins=yes ./program**. Any way **total heap usage: 20,531 allocs, 20,341 frees** you should start from here. – Michi Oct 28 '15 at 14:11

1 Answers1

0

Turns out it was a false leak, tested my code on a linux virtual machine and no errors. Thanks.

user1610834
  • 115
  • 2
  • 13
  • 1
    I had some fun trying to chase down some memory abuse on Mac OS X (Yosemite or El Capitan, I forget which, but probably El Capitan), where I was finally forced to conclude that the problem was in the library, not in my code which was calling the library. One of a number of factors in concluding that the problem was in 'the system' was that the same code worked cleanly under Linux. I also spent considerable time trying to modify the code so that it couldn't be mine that was at fault. 'Tis a nuisance. – Jonathan Leffler Oct 28 '15 at 15:32
  • Annoyingly enough I'm coming across a similar issue with doubles and floats and printing them. I'm going to test on a linux server soon and see what the real issue is. I can't seem to figure out what is going on. – Mike Huebner Nov 14 '15 at 10:37