Re: threads cleanup?



On Thu, 24 Apr 2008 12:04:20 +0300
Krassimir Slavchev <krassi@xxxxxxxxxxx> 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

Attachment: signature.asc
Description: PGP signature



Relevant Pages

  • Re: Detecting stack corruption
    ... > a module loader to it. ... but the test program I wrote ... Valgrind is very good at finding things like ... Erik de Castro Lopo nospam@mega-nerd.com ...
    (comp.os.linux.development.apps)
  • Re: [opensuse] Hard disk problem?
    ... Hash: SHA1 ... smartctl. ... I don't think I've a HD test program from the manufacturer. ...
    (SuSE)
  • Re: Detecting stack corruption
    ... but the test program I wrote ... >> stack frame is set up, well before the segfault), but I can't for the ... Valgrind is very good at finding things like ... > memory corruption. ...
    (comp.os.linux.development.apps)
  • Re: [OT] quick question about function declarations in C++
    ... Hash: SHA1 ... What happens if you create a small test program and try it out? ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)
  • Re: Segfault in getenv
    ... >> Can you produce the same error in a short test program? ... otherwise get valgrind up and running. ... > a libc bug... ... If you suspect a libc bug, try to isolate a simple test case that ...
    (comp.os.linux.development.apps)