Created attachment 38801 [details] test program that causes the valgrind warning On Mac OS X, pthread_cond_wait ends up calling new_sem_from_pool, which allocates a pool of semaphore objects that gets reused. This causes Valgrind to report a "still reachable" warning for this memory that is not leaked. Occasionally for more complex programs, this reports a full-blown "definitely lost" error. The attached program causes the SVN version of Valgrind to report this warning. The attached patch to the suppressions suppresses it. The source of the new_sem_from_pool function can be found: http://www.opensource.apple.com/source/Libc/Libc-583/pthreads/pthread.c
Created attachment 38802 [details] corrected test program that causes the warning
Created attachment 38803 [details] add a suppression for new_sem_from_pool
The original warning is: =23593== 64 bytes in 1 blocks are still reachable in loss record 2 of 3 ==23593== at 0x15416: malloc (vg_replace_malloc.c:195) ==23593== by 0x17225: realloc (vg_replace_malloc.c:476) ==23593== by 0x229507: new_sem_from_pool (in /usr/lib/libSystem.B.dylib) ==23593== by 0x2291A5: _pthread_cond_wait (in /usr/lib/libSystem.B.dylib) ==23593== by 0x228DCC: pthread_cond_wait$UNIX2003 (in /usr/lib/libSystem.B.dylib) ==23593== by 0x1E4A: main (in ./test) The original suppression is: { darwin-still-reachable-4 Memcheck:Leak fun:malloc fun:realloc fun:new_sem_from_pool fun:_pthread_cond_wait fun:pthread_cond_wait$UNIX2003 fun:main }
Resolved in r15190 for OS X 10.8.