valgrind --version --> valgrind-3.11.0.SVN Regardless of how simple a program might be, the memcheck tool always reports a leak. For instance: #include<stdio.h> main() { printf("Hello World"); } valgrind --leak-check=full ./a.out [2.0.0-p247] ==78952== Memcheck, a memory error detector ==78952== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==78952== Using Valgrind-3.11.0.SVN and LibVEX; rerun with -h for copyright info ==78952== Command: ./a.out ==78952== --78952-- ./a.out: --78952-- dSYM directory is missing; consider using --dsymutil=yes Hello World==78952== ==78952== HEAP SUMMARY: ==78952== in use at exit: 38,916 bytes in 426 blocks ==78952== total heap usage: 507 allocs, 81 frees, 45,060 bytes allocated ==78952== ==78952== 16 bytes in 1 blocks are definitely lost in loss record 7 of 82 ==78952== at 0x100008894: malloc_zone_malloc (in /usr/local/Cellar/valgrind/HEAD/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) ==78952== by 0x1004A29B1: recursive_mutex_init (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A26FC: _objc_init (in /usr/lib/libobjc.A.dylib) ==78952== by 0x10010B87C: _os_object_init (in /usr/lib/system/libdispatch.dylib) ==78952== by 0x10010B864: libdispatch_init (in /usr/lib/system/libdispatch.dylib) ==78952== by 0x100010A9F: libSystem_initializer (in /usr/lib/libSystem.B.dylib) ==78952== by 0x7FFF5FC12CEA: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld) ==78952== by 0x7FFF5FC12E77: ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) (in /usr/lib/dyld) ==78952== by 0x7FFF5FC0F870: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld) ==78952== by 0x7FFF5FC0F805: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld) ==78952== by 0x7FFF5FC0F6F7: ImageLoader::processInitializers(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld) ==78952== by 0x7FFF5FC0F968: ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) (in /usr/lib/dyld) ==78952== ==78952== 24 bytes in 1 blocks are possibly lost in loss record 15 of 82 ==78952== at 0x100008EA3: malloc_zone_calloc (in /usr/local/Cellar/valgrind/HEAD/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) ==78952== by 0x1004A4F02: NXHashInsert (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A4FF5: _NXHashRehashToCapacity (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A4F3F: NXHashInsert (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A49E1: NXCreateMapTableFromZone (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A5289: remappedClasses(signed char) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004B204E: remapClass(objc_class*) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004B2453: readClass(objc_class*, bool, bool) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A3E90: _read_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A3067: map_images_nolock (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A2B17: map_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x7FFF5FC0498E: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) (in /usr/lib/dyld) ==78952== ==78952== 32 bytes in 1 blocks are possibly lost in loss record 27 of 82 ==78952== at 0x100008EA3: malloc_zone_calloc (in /usr/local/Cellar/valgrind/HEAD/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) ==78952== by 0x1004A4EB4: NXHashInsert (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A4C00: NXCreateHashTableFromZone (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A3D7C: _read_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A3067: map_images_nolock (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A2B17: map_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x7FFF5FC0498E: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) (in /usr/lib/dyld) ==78952== by 0x7FFF5FC046D6: dyld::registerImageStateBatchChangeHandler(dyld_image_states, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) (in /usr/lib/dyld) ==78952== by 0x10015B958: dyld_register_image_state_change_handler (in /usr/lib/system/libdyld.dylib) ==78952== by 0x1004A2723: _objc_init (in /usr/lib/libobjc.A.dylib) ==78952== by 0x10010B87C: _os_object_init (in /usr/lib/system/libdispatch.dylib) ==78952== by 0x10010B864: libdispatch_init (in /usr/lib/system/libdispatch.dylib) ==78952== ==78952== 32 bytes in 1 blocks are possibly lost in loss record 28 of 82 ==78952== at 0x100008EA3: malloc_zone_calloc (in /usr/local/Cellar/valgrind/HEAD/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) ==78952== by 0x1004A4EB4: NXHashInsert (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A4FF5: _NXHashRehashToCapacity (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A4F3F: NXHashInsert (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004B342C: realizeClass(objc_class*) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004B291C: realizeClass(objc_class*) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A4610: _read_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A3067: map_images_nolock (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A2B17: map_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x7FFF5FC0498E: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) (in /usr/lib/dyld) ==78952== by 0x7FFF5FC046D6: dyld::registerImageStateBatchChangeHandler(dyld_image_states, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) (in /usr/lib/dyld) ==78952== by 0x10015B958: dyld_register_image_state_change_handler (in /usr/lib/system/libdyld.dylib) ==78952== ==78952== 48 bytes in 2 blocks are possibly lost in loss record 33 of 82 ==78952== at 0x100008EA3: malloc_zone_calloc (in /usr/local/Cellar/valgrind/HEAD/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) ==78952== by 0x1004A4F02: NXHashInsert (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A4FF5: _NXHashRehashToCapacity (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A4F3F: NXHashInsert (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004B342C: realizeClass(objc_class*) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004B291C: realizeClass(objc_class*) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A4610: _read_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A3067: map_images_nolock (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A2B17: map_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x7FFF5FC0498E: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) (in /usr/lib/dyld) ==78952== by 0x7FFF5FC046D6: dyld::registerImageStateBatchChangeHandler(dyld_image_states, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) (in /usr/lib/dyld) ==78952== by 0x10015B958: dyld_register_image_state_change_handler (in /usr/lib/system/libdyld.dylib) ==78952== ==78952== 72 bytes in 3 blocks are possibly lost in loss record 43 of 82 ==78952== at 0x100008EA3: malloc_zone_calloc (in /usr/local/Cellar/valgrind/HEAD/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) ==78952== by 0x1004A4F02: NXHashInsert (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004B342C: realizeClass(objc_class*) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004B291C: realizeClass(objc_class*) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A4610: _read_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A3067: map_images_nolock (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A2B17: map_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x7FFF5FC0498E: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) (in /usr/lib/dyld) ==78952== by 0x7FFF5FC046D6: dyld::registerImageStateBatchChangeHandler(dyld_image_states, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) (in /usr/lib/dyld) ==78952== by 0x10015B958: dyld_register_image_state_change_handler (in /usr/lib/system/libdyld.dylib) ==78952== by 0x1004A2723: _objc_init (in /usr/lib/libobjc.A.dylib) ==78952== by 0x10010B87C: _os_object_init (in /usr/lib/system/libdispatch.dylib) ==78952== ==78952== 72 bytes in 3 blocks are possibly lost in loss record 44 of 82 ==78952== at 0x100008EA3: malloc_zone_calloc (in /usr/local/Cellar/valgrind/HEAD/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) ==78952== by 0x1004A4F02: NXHashInsert (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004B343D: realizeClass(objc_class*) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A4610: _read_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A3067: map_images_nolock (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A2B17: map_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x7FFF5FC0498E: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) (in /usr/lib/dyld) ==78952== by 0x7FFF5FC046D6: dyld::registerImageStateBatchChangeHandler(dyld_image_states, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) (in /usr/lib/dyld) ==78952== by 0x10015B958: dyld_register_image_state_change_handler (in /usr/lib/system/libdyld.dylib) ==78952== by 0x1004A2723: _objc_init (in /usr/lib/libobjc.A.dylib) ==78952== by 0x10010B87C: _os_object_init (in /usr/lib/system/libdispatch.dylib) ==78952== by 0x10010B864: libdispatch_init (in /usr/lib/system/libdispatch.dylib) ==78952== ==78952== 96 bytes in 3 blocks are possibly lost in loss record 47 of 82 ==78952== at 0x100008EA3: malloc_zone_calloc (in /usr/local/Cellar/valgrind/HEAD/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) ==78952== by 0x1004A4EB4: NXHashInsert (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A4FF5: _NXHashRehashToCapacity (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A4F3F: NXHashInsert (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004B343D: realizeClass(objc_class*) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A4610: _read_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A3067: map_images_nolock (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A2B17: map_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x7FFF5FC0498E: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) (in /usr/lib/dyld) ==78952== by 0x7FFF5FC046D6: dyld::registerImageStateBatchChangeHandler(dyld_image_states, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) (in /usr/lib/dyld) ==78952== by 0x10015B958: dyld_register_image_state_change_handler (in /usr/lib/system/libdyld.dylib) ==78952== by 0x1004A2723: _objc_init (in /usr/lib/libobjc.A.dylib) ==78952== ==78952== 152 bytes in 4 blocks are possibly lost in loss record 50 of 82 ==78952== at 0x100008EA3: malloc_zone_calloc (in /usr/local/Cellar/valgrind/HEAD/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) ==78952== by 0x1004A4EB4: NXHashInsert (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004B343D: realizeClass(objc_class*) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A4610: _read_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A3067: map_images_nolock (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A2B17: map_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x7FFF5FC0498E: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) (in /usr/lib/dyld) ==78952== by 0x7FFF5FC046D6: dyld::registerImageStateBatchChangeHandler(dyld_image_states, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) (in /usr/lib/dyld) ==78952== by 0x10015B958: dyld_register_image_state_change_handler (in /usr/lib/system/libdyld.dylib) ==78952== by 0x1004A2723: _objc_init (in /usr/lib/libobjc.A.dylib) ==78952== by 0x10010B87C: _os_object_init (in /usr/lib/system/libdispatch.dylib) ==78952== by 0x10010B864: libdispatch_init (in /usr/lib/system/libdispatch.dylib) ==78952== ==78952== 184 bytes in 5 blocks are possibly lost in loss record 53 of 82 ==78952== at 0x100008EA3: malloc_zone_calloc (in /usr/local/Cellar/valgrind/HEAD/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) ==78952== by 0x1004A4EB4: NXHashInsert (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004B342C: realizeClass(objc_class*) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004B291C: realizeClass(objc_class*) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A4610: _read_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A3067: map_images_nolock (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A2B17: map_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x7FFF5FC0498E: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) (in /usr/lib/dyld) ==78952== by 0x7FFF5FC046D6: dyld::registerImageStateBatchChangeHandler(dyld_image_states, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) (in /usr/lib/dyld) ==78952== by 0x10015B958: dyld_register_image_state_change_handler (in /usr/lib/system/libdyld.dylib) ==78952== by 0x1004A2723: _objc_init (in /usr/lib/libobjc.A.dylib) ==78952== by 0x10010B87C: _os_object_init (in /usr/lib/system/libdispatch.dylib) ==78952== ==78952== 528 bytes in 1 blocks are possibly lost in loss record 63 of 82 ==78952== at 0x100008894: malloc_zone_malloc (in /usr/local/Cellar/valgrind/HEAD/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) ==78952== by 0x1004A4A29: NXCreateMapTableFromZone (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A5D40: unattachedCategories() (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004B3329: realizeClass(objc_class*) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004B291C: realizeClass(objc_class*) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004B2909: realizeClass(objc_class*) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004B2909: realizeClass(objc_class*) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004B2909: realizeClass(objc_class*) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A4610: _read_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A3067: map_images_nolock (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A2B17: map_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x7FFF5FC0498E: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) (in /usr/lib/dyld) ==78952== ==78952== 730 bytes in 44 blocks are possibly lost in loss record 67 of 82 ==78952== at 0x100008894: malloc_zone_malloc (in /usr/local/Cellar/valgrind/HEAD/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) ==78952== by 0x1004A5A6B: _strdup_internal (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A5A21: NXMapKeyCopyingInsert (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A44C2: _read_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A3067: map_images_nolock (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A2B17: map_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x7FFF5FC0498E: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) (in /usr/lib/dyld) ==78952== by 0x7FFF5FC046D6: dyld::registerImageStateBatchChangeHandler(dyld_image_states, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) (in /usr/lib/dyld) ==78952== by 0x10015B958: dyld_register_image_state_change_handler (in /usr/lib/system/libdyld.dylib) ==78952== by 0x1004A2723: _objc_init (in /usr/lib/libobjc.A.dylib) ==78952== by 0x10010B87C: _os_object_init (in /usr/lib/system/libdispatch.dylib) ==78952== by 0x10010B864: libdispatch_init (in /usr/lib/system/libdispatch.dylib) ==78952== ==78952== 1,040 bytes in 1 blocks are possibly lost in loss record 71 of 82 ==78952== at 0x100008894: malloc_zone_malloc (in /usr/local/Cellar/valgrind/HEAD/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) ==78952== by 0x1004A4A29: NXCreateMapTableFromZone (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A5289: remappedClasses(signed char) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004B204E: remapClass(objc_class*) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004B2453: readClass(objc_class*, bool, bool) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A3E90: _read_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A3067: map_images_nolock (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A2B17: map_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x7FFF5FC0498E: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) (in /usr/lib/dyld) ==78952== by 0x7FFF5FC046D6: dyld::registerImageStateBatchChangeHandler(dyld_image_states, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) (in /usr/lib/dyld) ==78952== by 0x10015B958: dyld_register_image_state_change_handler (in /usr/lib/system/libdyld.dylib) ==78952== by 0x1004A2723: _objc_init (in /usr/lib/libobjc.A.dylib) ==78952== ==78952== 1,040 bytes in 1 blocks are possibly lost in loss record 72 of 82 ==78952== at 0x100008894: malloc_zone_malloc (in /usr/local/Cellar/valgrind/HEAD/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) ==78952== by 0x1004A4A29: NXCreateMapTableFromZone (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A51F9: futureNamedClasses() (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004B2485: readClass(objc_class*, bool, bool) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A3E90: _read_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A3067: map_images_nolock (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A2B17: map_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x7FFF5FC0498E: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) (in /usr/lib/dyld) ==78952== by 0x7FFF5FC046D6: dyld::registerImageStateBatchChangeHandler(dyld_image_states, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) (in /usr/lib/dyld) ==78952== by 0x10015B958: dyld_register_image_state_change_handler (in /usr/lib/system/libdyld.dylib) ==78952== by 0x1004A2723: _objc_init (in /usr/lib/libobjc.A.dylib) ==78952== by 0x10010B87C: _os_object_init (in /usr/lib/system/libdispatch.dylib) ==78952== ==78952== 1,040 bytes in 1 blocks are possibly lost in loss record 73 of 82 ==78952== at 0x100008894: malloc_zone_malloc (in /usr/local/Cellar/valgrind/HEAD/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) ==78952== by 0x1004A5B1A: _NXMapRehash(_NXMapTable*) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A5828: NXMapInsert (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A44C2: _read_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A3067: map_images_nolock (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A2B17: map_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x7FFF5FC0498E: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) (in /usr/lib/dyld) ==78952== by 0x7FFF5FC046D6: dyld::registerImageStateBatchChangeHandler(dyld_image_states, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) (in /usr/lib/dyld) ==78952== by 0x10015B958: dyld_register_image_state_change_handler (in /usr/lib/system/libdyld.dylib) ==78952== by 0x1004A2723: _objc_init (in /usr/lib/libobjc.A.dylib) ==78952== by 0x10010B87C: _os_object_init (in /usr/lib/system/libdispatch.dylib) ==78952== by 0x10010B864: libdispatch_init (in /usr/lib/system/libdispatch.dylib) ==78952== ==78952== 2,064 bytes in 1 blocks are possibly lost in loss record 76 of 82 ==78952== at 0x100008894: malloc_zone_malloc (in /usr/local/Cellar/valgrind/HEAD/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) ==78952== by 0x1004A4A29: NXCreateMapTableFromZone (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A3D0C: _read_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A3067: map_images_nolock (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A2B17: map_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x7FFF5FC0498E: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) (in /usr/lib/dyld) ==78952== by 0x7FFF5FC046D6: dyld::registerImageStateBatchChangeHandler(dyld_image_states, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) (in /usr/lib/dyld) ==78952== by 0x10015B958: dyld_register_image_state_change_handler (in /usr/lib/system/libdyld.dylib) ==78952== by 0x1004A2723: _objc_init (in /usr/lib/libobjc.A.dylib) ==78952== by 0x10010B87C: _os_object_init (in /usr/lib/system/libdispatch.dylib) ==78952== by 0x10010B864: libdispatch_init (in /usr/lib/system/libdispatch.dylib) ==78952== by 0x100010A9F: libSystem_initializer (in /usr/lib/libSystem.B.dylib) ==78952== ==78952== 2,064 bytes in 1 blocks are possibly lost in loss record 77 of 82 ==78952== at 0x100008894: malloc_zone_malloc (in /usr/local/Cellar/valgrind/HEAD/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) ==78952== by 0x1004A5B1A: _NXMapRehash(_NXMapTable*) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A5828: NXMapInsert (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004B9907: __sel_registerName(char const*, int, int) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A884F: fixupMethodList(method_list_t*, bool, bool) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004B7783: attachMethodLists(objc_class*, method_list_t**, int, bool, bool, bool) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004B32FC: realizeClass(objc_class*) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004B291C: realizeClass(objc_class*) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004B2909: realizeClass(objc_class*) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004B2909: realizeClass(objc_class*) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004B2909: realizeClass(objc_class*) (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A4610: _read_images (in /usr/lib/libobjc.A.dylib) ==78952== ==78952== 3,872 bytes in 44 blocks are possibly lost in loss record 80 of 82 ==78952== at 0x100008EA3: malloc_zone_calloc (in /usr/local/Cellar/valgrind/HEAD/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) ==78952== by 0x1004A448C: _read_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A3067: map_images_nolock (in /usr/lib/libobjc.A.dylib) ==78952== by 0x1004A2B17: map_images (in /usr/lib/libobjc.A.dylib) ==78952== by 0x7FFF5FC0498E: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) (in /usr/lib/dyld) ==78952== by 0x7FFF5FC046D6: dyld::registerImageStateBatchChangeHandler(dyld_image_states, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) (in /usr/lib/dyld) ==78952== by 0x10015B958: dyld_register_image_state_change_handler (in /usr/lib/system/libdyld.dylib) ==78952== by 0x1004A2723: _objc_init (in /usr/lib/libobjc.A.dylib) ==78952== by 0x10010B87C: _os_object_init (in /usr/lib/system/libdispatch.dylib) ==78952== by 0x10010B864: libdispatch_init (in /usr/lib/system/libdispatch.dylib) ==78952== by 0x100010A9F: libSystem_initializer (in /usr/lib/libSystem.B.dylib) ==78952== by 0x7FFF5FC12CEA: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld) ==78952== ==78952== LEAK SUMMARY: ==78952== definitely lost: 16 bytes in 1 blocks ==78952== indirectly lost: 0 bytes in 0 blocks ==78952== possibly lost: 13,090 bytes in 117 blocks ==78952== still reachable: 25,810 bytes in 308 blocks ==78952== suppressed: 0 bytes in 0 blocks ==78952== Reachable blocks (those to which a pointer was found) are not shown. ==78952== To see them, rerun with: --leak-check=full --show-leak-kinds=all ==78952== ==78952== For counts of detected and suppressed errors, rerun with: -v ==78952== ERROR SUMMARY: 18 errors from 18 contexts (suppressed: 0 from 0) Reproducible: Always Steps to Reproduce: Create any simple hello world in C or Rust and run valgrind on it. Actual Results: You'll get a result stating a memory leak where none should exits. (False positive) Expected Results: No memory leak should be reported. I tried this also with a simple Rust programs with the same results ( for what is worth)
This is something I'm looking at. Can confirm the report. I've also seen it a few times in the regression tests.
This is a duplicate of bz#344702. It appears fixed for me following r14972, but would appreciate your confirmation fmendez.
After getting the latest from trunk, I can still see the issue: Hello word in C: #include<stdio.h> main() { printf("Hello World"); } fmendez@fmendez-mba ~/Desktop/start/oss/test-c $ valgrind --leak-check=full --show-leak-kinds=all ./a.out [2.0.0-p247] ==55904== Memcheck, a memory error detector ==55904== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==55904== Using Valgrind-3.11.0.SVN and LibVEX; rerun with -h for copyright info ==55904== Command: ./a.out ==55904== --55904-- ./a.out: --55904-- dSYM directory is missing; consider using --dsymutil=yes Hello World==55904== ==55904== HEAP SUMMARY: ==55904== in use at exit: 38,852 bytes in 426 blocks ==55904== total heap usage: 507 allocs, 81 frees, 44,996 bytes allocated ==55904== ==55904== 4,096 bytes in 1 blocks are still reachable in loss record 82 of 82 ==55904== at 0x10000859B: malloc (in /usr/local/Cellar/valgrind/HEAD/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) ==55904== by 0x1001F0856: __smakebuf (in /usr/lib/system/libsystem_c.dylib) ==55904== by 0x1002053A7: __swsetup (in /usr/lib/system/libsystem_c.dylib) ==55904== by 0x10021F77D: __v2printf (in /usr/lib/system/libsystem_c.dylib) ==55904== by 0x10021FCA0: __xvprintf (in /usr/lib/system/libsystem_c.dylib) ==55904== by 0x1001F5B91: vfprintf_l (in /usr/lib/system/libsystem_c.dylib) ==55904== by 0x1001F39F7: printf (in /usr/lib/system/libsystem_c.dylib) ==55904== by 0x100000F55: main (in ./a.out) ==55904== ==55904== LEAK SUMMARY: ==55904== definitely lost: 0 bytes in 0 blocks ==55904== indirectly lost: 0 bytes in 0 blocks ==55904== possibly lost: 0 bytes in 0 blocks ==55904== still reachable: 4,096 bytes in 1 blocks ==55904== suppressed: 34,756 bytes in 425 blocks ==55904== ==55904== For counts of detected and suppressed errors, rerun with: -v ==55904== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 18 from 18) Hello world in Rust: fn main() { println!("hello world"); } fmendez@fmendez-mba ~/Desktop/start/oss/test-rs/target (master●)$ valgrind --leak-check=full --show-leak-kinds=all ./test-rs ==55341== Memcheck, a memory error detector ==55341== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==55341== Using Valgrind-3.11.0.SVN and LibVEX; rerun with -h for copyright info ==55341== Command: ./test-rs ==55341== hello world ==55341== ==55341== HEAP SUMMARY: ==55341== in use at exit: 35,060 bytes in 429 blocks ==55341== total heap usage: 517 allocs, 88 frees, 42,700 bytes allocated ==55341== ==55341== 152 bytes in 1 blocks are still reachable in loss record 50 of 82 ==55341== at 0x10005359B: malloc (in /usr/local/Cellar/valgrind/HEAD/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) ==55341== by 0x1001A6D9F: tlv_allocate_and_initialize_for_key (in /usr/lib/system/libdyld.dylib) ==55341== by 0x1001A7548: tlv_get_addr (in /usr/lib/system/libdyld.dylib) ==55341== by 0x100003012: sys_common::thread_info::set::h29886cc577a55c14auH (in ./test-rs) ==55341== by 0x10000B32A: rt::lang_start::hf7db7ff2962d1e05DZI (in ./test-rs) ==55341== by 0x100000B1E: main (in ./test-rs) ==55341== ==55341== LEAK SUMMARY: ==55341== definitely lost: 0 bytes in 0 blocks ==55341== indirectly lost: 0 bytes in 0 blocks ==55341== possibly lost: 0 bytes in 0 blocks ==55341== still reachable: 152 bytes in 1 blocks ==55341== suppressed: 34,908 bytes in 428 blocks ==55341== ==55341== For counts of detected and suppressed errors, rerun with: -v If there any other information/help I can contribute, please let me know. Regards,
Hi, Thanks for reverting with the new info. Many of the previous system library leaks are now suppressed (as expected). So that's good news. There are different leaks you are now seeing, which I also have seen with certain regression tests. Do you mind attaching the output of: 1. Those two programs with "-v" command line option added, and 2. The output of "nm /usr/lib/system/libdyld.dylib" and "nm /usr/lib/system/libsystem_c.dylib".
Sure, here it is (had to create a gist since the comment didn't fit here): https://gist.github.com/fmendez/0f921fdf76d6e2a1eda0 Regards,
fmendez, Would you mind confirming that with latest Valgrind trunk, you only see the Rust related issue of the two above that you reported?
Austins-Mac-mini:valgrind austin$ cat foo.c #include <stdio.h> int main() { printf("Hello world\n"); } Austins-Mac-mini:valgrind austin$ gcc -o a.out foo.c Austins-Mac-mini:valgrind austin$ ./vg-in-place --leak-check=full ./a.out ==33055== Memcheck, a memory error detector ==33055== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==33055== Using Valgrind-3.11.0.SVN and LibVEX; rerun with -h for copyright info ==33055== Command: ./a.out ==33055== --33055-- ./a.out: --33055-- dSYM directory is missing; consider using --dsymutil=yes Hello world ==33055== ==33055== HEAP SUMMARY: ==33055== in use at exit: 38,764 bytes in 425 blocks ==33055== total heap usage: 505 allocs, 80 frees, 44,892 bytes allocated ==33055== ==33055== LEAK SUMMARY: ==33055== definitely lost: 0 bytes in 0 blocks ==33055== indirectly lost: 0 bytes in 0 blocks ==33055== possibly lost: 0 bytes in 0 blocks ==33055== still reachable: 0 bytes in 0 blocks ==33055== suppressed: 38,764 bytes in 425 blocks ==33055== ==33055== For counts of detected and suppressed errors, rerun with: -v ==33055== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 15 from 15) Austins-Mac-mini:valgrind austin$ svn info Path: . Working Copy Root Path: /Users/austin/src/valgrind URL: svn://svn.valgrind.org/valgrind/trunk Repository Root: svn://svn.valgrind.org/valgrind Repository UUID: a5019735-40e9-0310-863c-91ae7b9d1cf9 Revision: 15258 Node Kind: directory Schedule: normal Last Changed Author: carll Last Changed Rev: 15258 Last Changed Date: 2015-05-19 11:16:52 -0500 (Tue, 19 May 2015) works here. Can't confirm the rust results (I don't use rust :) ).
Austin, Thanks for your confirmation that a simple Hello World test program also reports cleanly on your system, after r15255. I am seeing that too here across both of my OS X 10.10 development systems. I'm inclined to close this bug report as RESOLVED because valgrind no longer reports leaks on OS X 10.10 regardless of the simplicity of a program. A new specific bug report can be opened for further reports from Rust (or any other program).