I' trying to figure out what's causing Valgrind to warn about some 'still reachable' blocks. I've reviewed my code and can't find any free() missing. I tried running with --leak-check=yes --show-reachable=yes options and this is an example of the output:
==2999== 616 bytes in 7 blocks are still reachable in loss record 8 of 9
==2999== at 0xD9C3: calloc (vg_replace_malloc.c:597)
==2999== by 0x3188FA: _xpc_calloc (in /usr/lib/system/libxpc.dylib)
==2999== by 0x3191D4: _xpc_base_create (in /usr/lib/system/libxpc.dylib)
==2999== by 0x31FBEA: xpc_string_create (in /usr/lib/system/libxpc.dylib)
==2999== by 0x31EDFD: xpc_dictionary_set_string (in /usr/lib/system/libxpc.dylib)
==2999== by 0x320E8C: _libxpc_initializer (in /usr/lib/system/libxpc.dylib)
==2999== by 0x1BE7D: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==2999== by 0x7FFF5FC0FDA5: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2999== by 0x7FFF5FC0FAF1: ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2999== by 0x7FFF5FC0D2E3: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&) (in /usr/lib/dyld)
==2999== by 0x7FFF5FC0D27C: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&) (in /usr/lib/dyld)
==2999== by 0x7FFF5FC0E0B6: ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) (in /usr/lib/dyld)
==2999== 4,096 bytes in 1 blocks are still reachable in loss record 9 of 9
==2999== at 0xC713: malloc (vg_replace_malloc.c:274)
==2999== by 0x17F3F7: __smakebuf (in /usr/lib/system/libsystem_c.dylib)
==2999== by 0x175D19: __swsetup (in /usr/lib/system/libsystem_c.dylib)
==2999== by 0x1766C3: __vfprintf (in /usr/lib/system/libsystem_c.dylib)
==2999== by 0x17618D: vfprintf_l (in /usr/lib/system/libsystem_c.dylib)
==2999== by 0x17F2CF: printf (in /usr/lib/system/libsystem_c.dylib)
==2999== by 0x100003D21: printEstBasica (mod_dados.c:100)
==2999== by 0x100001635: main (mod_main.c:179)
The lines I understand either refer to 'printing' functions (like the printEstBasica), on which I only use printf's or fprintf's...the other ones I can't figure out what they are.. I read on other posts people saying that it may refer to additional info that the compiler used..but I'm not sure. One thing that leads me into thinking that: I ran the valgrind on different sets of data (to be processed by the program), with different sizes and the number of still reachable bytes is always the same..
Thanks in advance!