threads cleanup?

Alexander Kabaev kabaev at gmail.com
Fri Apr 25 20:17:42 UTC 2008


On Thu, 24 Apr 2008 12:04:20 +0300
Krassimir Slavchev <krassi at bulinfo.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hello,
> 
> Most probably I missed something.
> I have problems with threads cleanup. Here are output of valgrind and
> simple test program:
> 
> ...
> ==78317== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from
> 0) ==78317== malloc/free: in use at exit: 4108 bytes in 2 blocks.
> ==78317== malloc/free: 5 allocs, 3 frees, 4324 bytes allocated.
> ==78317==
> ==78317== searching for pointers to 2 not-freed blocks.
> ==78317== checked 1468040 bytes.
> ==78317==
> ==78317== 12 bytes in 1 blocks are still reachable in loss record 1
> of 2 ==78317==    at 0x3C038183: malloc (in
> /usr/local/lib/valgrind/vgpreload_memcheck.so)
> ==78317==    by 0x3C03F8D0:
> (within /usr/local/lib/valgrind/libthr.so.2) ==78317==    by
> 0x3C040F49: pthread_mutex_init
> (in /usr/local/lib/valgrind/libthr.so.2) ==78317==    by 0x3C040FA9:
> pthread_mutex_lock (in /usr/local/lib/valgrind/libthr.so.2)
> ==78317==
> ==78317==
> ==78317== 4096 bytes in 1 blocks are still reachable in loss record 2
> of 2 ==78317==    at 0x3C038183: malloc (in
> /usr/local/lib/valgrind/vgpreload_memcheck.so)
> ==78317==    by 0x3C121AE5: __smakebuf (in /lib/libc.so.6)
> ==78317==    by 0x3C1219B0: __swsetup (in /lib/libc.so.6)
> ==78317==    by 0x3C11789B: __vfprintf (in /lib/libc.so.6)
> ...

You definitely need deeper stacktrace to see where mutexes are
allocated. Info above says nothing otherwise.

Also, note that when running threaded programs under valgrind you are
testing valgrind's own threading library implementatiion, not 'real'
libthr.
-- 
Alexander Kabaev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20080425/0084489a/signature.pgp


More information about the freebsd-stable mailing list