Boost logo

Boost Users :

Subject: Re: [Boost-users] [thread] 1 blocks are still reachable in loss record
From: Nikolai N Fetissov (nikolai-boost_at_[hidden])
Date: 2009-12-14 15:06:06


Looks like this has been fixed already - I can confirm the leak
with 1.37, but cannot reproduce it with 1.40:

1.37:
~$ valgrind --tool=memcheck --leak-check=full --show-reachable=yes ./a.out
...
==13406== 8 bytes in 1 blocks are still reachable in loss record 1 of 2
==13406== at 0x43F6405: malloc (vg_replace_malloc.c:149)
==13406== by 0x4456BFE: boost::detail::get_once_per_thread_epoch() (in
/usr/local-1.1.9/lib/libboost_thread-gcc41-mt-p-1_37.so.1.37.0)
==13406== by 0x4454CF6: void boost::call_once<void
(*)()>(boost::once_flag&, void (*)()) (in
/usr/local-1.1.9/lib/libboost_thread-gcc41-mt-p-1_37.so.1.37.0)
==13406== by 0x44510F9: boost::detail::get_current_thread_data() (in
/usr/local-1.1.9/lib/libboost_thread-gcc41-mt-p-1_37.so.1.37.0)
==13406== by 0x4452CD5: boost::thread::join() (in
/usr/local-1.1.9/lib/libboost_thread-gcc41-mt-p-1_37.so.1.37.0)
==13406== by 0x804909A: main (boo_th.cpp:13)
==13406==

1.40:
...
==30689==
==30689== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 5 from 1)
==30689== malloc/free: in use at exit: 0 bytes in 0 blocks.
==30689== malloc/free: 5 allocs, 5 frees, 648 bytes allocated.
==30689== For counts of detected errors, rerun with: -v
==30689== All heap blocks were freed -- no leaks are possible.

--
 Nikolai
> Hi all,
> Valgrind reports follows memory leak.
> ==24567==    at 0x4A1FE1B: malloc (vg_replace_malloc.c:207)
> ==24567==    by 0x6AC7FDD: boost::detail::get_once_per_thread_epoch()
> (in /app/local/pkgs/boost/lib/libboost_thread-gcc41-mt-1_39.so.1.39.0)
> ==24567==    by 0x6AC4A17: void boost::call_once<void
> (*)()>(boost::once_flag&, void (*)()) (in
> /app/local/pkgs/boost/lib/libboost_thread-gcc41-mt-1_39.so.1.39.0)
> ==24567==    by 0x6AC1D96: boost::detail::get_current_thread_data() (in
> /app/local/pkgs/boost/lib/libboost_thread-gcc41-mt-1_39.so.1.39.0)
> ==24567==    by 0x6AC36B4: boost::thread::join() (in
> /app/local/pkgs/boost/lib/libboost_thread-gcc41-mt-1_39.so.1.39.0)
>
> Code is looks like:
>
> thread_->join();
> delete thread_;
>

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net