Opened 16 years ago

Closed 16 years ago

#681 closed Bugs (None)

Memoryleak when using boost::thread and boost::test together

Reported by: sergeipanov Owned by: Roland Schwarz
Milestone: Component: threads
Version: None Severity:
Keywords: Cc:

Description

When I tried to use boost::thread with boost::test 
(Unit Test Framework) I've always got the followed 
message:
Detected memory leaks!
Dumping objects ->
{227} normal block at 0x00364698, 24 bytes long.
 Data: <PS              > 50 53 14 00 FF FF FF FF 00 
00 00 00 00 00 00 00
{226} normal block at 0x00364428, 8 bytes long.
 Data: < F6     > 98 46 36 00 01 CD CD CD
Object dump complete.

It does not matter from Boost version (I tried the 
latest one as well). The error is reproduced with 
simple examples from boost::thread docs.

Platform: Win32
Compiler: Microsoft Visual C++ version 7.1
STL     : Dinkumware standard library version 313
Boost   : 1.33.1

Could you help me?

Thanks in advance!
Sergei Panov

Change History (3)

comment:1 by nobody, 16 years ago

Logged In: NO 

Hi I have also detected more memoryleaks, hope you can fix 
them.

    c:\program files\microsoft visual studio .net 2003\vc7
\include\vector (828): std::vector<void 
*,std::allocator<void *> >::_Insert_n
    c:\boost_1_32_0\boost\thread\tss.hpp (98): 
boost::thread_specific_ptr<std::vector<CRegister 
*,std::allocator<CRegister *> > >::reset

---------- Block 34424 at 0x01B6E3F8: 8 bytes ----------
  Call Stack:
    c:\program files\microsoft visual studio .net 2003\vc7
\include\vector (828): 
std::vector<boost::function1<void,void 
*,std::allocator<boost::function_base> > 
*,std::allocator<boost::function1<void,void 
*,std::allocator<boost::function_base> > *> >::_Insert_n
    c:\boost\thread\tss.hpp (38): boost::detail::tss::tss
    c:\boost\thread\tss.hpp (86): 
boost::thread_specific_ptr<std::vector<CRegister 
*,std::allocator<CRegister *> > 
>::thread_specific_ptr<std::vector<CRegister 
*,std::allocator<CRegister *> > >
---------- Block 34423 at 0x01B6E3B0: 12 bytes ----------
  Call Stack:
    c:\program files\microsoft visual studio .net 2003\vc7
\include\xmemory (34): 
std::_Allocate<boost::detail::tss_adapter<std::vector<CRegi
ster *,std::allocator<CRegister *> > > >
    c:\program files\microsoft visual studio .net 2003\vc7
\include\xmemory (137): 
std::allocator<boost::detail::tss_adapter<std::vector<CRegi
ster *,std::allocator<CRegister *> > > >::allocate
    c:\boost\function\function_template.hpp (490): 
boost::function1<void,void 
*,std::allocator<boost::function_base> 
>::assign_to<boost::detail::tss_adapter<std::vector<CRegist
er *,std::allocator<CRegister *> > > >
    c:\boost\function\function_template.hpp (434): 
boost::function1<void,void 
*,std::allocator<boost::function_base> 
>::assign_to<boost::detail::tss_adapter<std::vector<CRegist
er *,std::allocator<CRegister *> > > >
    c:\boost\function\function_template.hpp (290): 
boost::function1<void,void 
*,std::allocator<boost::function_base> 
>::function1<void,void 
*,std::allocator<boost::function_base> 
><boost::detail::tss_adapter<std::vector<CRegister 
*,std::allocator<CRegister *> > > >
    c:\boost\thread\tss.hpp (85): 
boost::thread_specific_ptr<std::vector<CRegister 
*,std::allocator<CRegister *> > 
>::thread_specific_ptr<std::vector<CRegister 
*,std::allocator<CRegister *> > >
---------- Block 34422 at 0x01B6E368: 12 bytes ----------
  Call Stack:
    c:\boost\thread\tss.hpp (85): 
boost::thread_specific_ptr<std::vector<CRegister 
*,std::allocator<CRegister *> > 
>::thread_specific_ptr<std::vector<CRegister 
*,std::allocator<CRegister *> > >
---------- Block 30267 at 0x01A106D0: 16 bytes ----------
  Call Stack:
    c:\libs\thread\src\tss.cpp (119): `anonymous 
namespace'::get_slots
    c:\boost\thread\tss.hpp (98): 
boost::thread_specific_ptr<std::vector<CRegister 
*,std::allocator<CRegister *> > >::reset
---------- Block 2656 at 0x00F4E240: 24 bytes ----------
  Call Stack:
    c:\libs\thread\src\mutex.inl (55): `anonymous 
namespace'::new_critical_section
    c:\libs\thread\src\mutex.cpp (48): boost::mutex::mutex
    c:\libs\thread\src\tss.cpp (149): 
boost::detail::tss::init
    c:\boost\thread\tss.hpp (38): boost::detail::tss::tss
    c:\boost\thread\tss.hpp (86): 
boost::thread_specific_ptr<std::vector<CRegister 
*,std::allocator<CRegister *> > 
>::thread_specific_ptr<std::vector<CRegister 
*,std::allocator<CRegister *> > >
---------- Block 2655 at 0x00F4E1E8: 28 bytes ----------
  Call Stack:
    c:\libs\thread\src\tss.cpp (63): `anonymous 
namespace'::init_tss_data
    c:\libs\thread\src\tss.cpp (149): 
boost::detail::tss::init
    c:\boost\thread\tss.hpp (38): boost::detail::tss::tss
    c:\boost\thread\tss.hpp (86): 
boost::thread_specific_ptr<std::vector<CRegister 
*,std::allocator<CRegister *> > 
>::thread_specific_ptr<std::vector<CRegister 
*,std::allocator<CRegister *> > >

---------- Block 2647 at 0x00F4E0C8: 12 bytes ----------
  Call Stack:
    c:\program files\microsoft visual studio .net 2003\vc7
\include\xmemory (34): 
std::_Allocate<boost::detail::tss_adapter<std::vector<CRegi
ster *,std::allocator<CRegister *> > > >
    c:\program files\microsoft visual studio .net 2003\vc7
\include\xmemory (137): 
std::allocator<boost::detail::tss_adapter<std::vector<CRegi
ster *,std::allocator<CRegister *> > > >::allocate
    c:\boost\function\function_template.hpp (490): 
boost::function1<void,void 
*,std::allocator<boost::function_base> 
>::assign_to<boost::detail::tss_adapter<std::vector<CRegist
er *,std::allocator<CRegister *> > > >
    c:\boost\function\function_template.hpp (434): 
boost::function1<void,void 
*,std::allocator<boost::function_base> 
>::assign_to<boost::detail::tss_adapter<std::vector<CRegist
er *,std::allocator<CRegister *> > > >
    c:\boost\function\function_template.hpp (290): 
boost::function1<void,void 
*,std::allocator<boost::function_base> 
>::function1<void,void 
*,std::allocator<boost::function_base> 
><boost::detail::tss_adapter<std::vector<CRegister 
*,std::allocator<CRegister *> > > >
    c:\boost\thread\tss.hpp (85): 
boost::thread_specific_ptr<std::vector<CRegister 
*,std::allocator<CRegister *> > 
>::thread_specific_ptr<std::vector<CRegister 
*,std::allocator<CRegister *> > >
---------- Block 2646 at 0x00F4E080: 12 bytes ----------
  Call Stack:
    c:\boost\thread\tss.hpp (85): 
boost::thread_specific_ptr<std::vector<CRegister 
*,std::allocator<CRegister *> > 
>::thread_specific_ptr<std::vector<CRegister 
*,std::allocator<CRegister *> > >

---------- Block 250 at 0x00E1B4B8: 24 bytes ----------
  Call Stack:
    c:\libs\thread\src\mutex.inl (55): `anonymous 
namespace'::new_critical_section
    c:\libs\thread\src\mutex.cpp (48): boost::mutex::mutex
    c:\libs\thread\src\tss_hooks.cpp (121): 
on_process_enter
---------- Block 249 at 0x00E1B650: 8 bytes ----------
  Call Stack:
    c:\libs\thread\src\tss_hooks.cpp (29): `anonymous 
namespace'::init_threadmon_mutex
    c:\libs\thread\src\tss_hooks.cpp (121): 
on_process_enter


Thank you



comment:2 by Roland Schwarz, 16 years ago

Logged In: YES 
user_id=541730

This error most likely was related to the TSS global mutex
leak. It has been fixed for 1.34 and 1.35

comment:3 by Roland Schwarz, 16 years ago

Status: assignedclosed
Note: See TracTickets for help on using tickets.