Boost logo

Boost Users :

Subject: [Boost-users] [asio] Boost-1.65.0 TlsSlot leak on win32
From: Klebsch, Mario (Mario.Klebsch_at_[hidden])
Date: 2018-03-19 16:08:18


Hi,

I am using boost version 1.65.0 in a 32 bit DLL. I use VS2005

When using ApplicationVerifier, I got application verifier stops due to leaked TLS slots.

The TLS slots are allocated in win_tss_ptr_create(). Each slot is wrapped into RAII class win_tss_ptr. The constructor allocates the TLS slot and the destructor de-allocates it.
I put printf-Statements in both methods and I see, that the constructor is called twice, while the destructor is not called at all. If I put a breakpoint into the destructor, it never triggers.

The printf() satemets show, that the following instances have been constructed:

boost::asio::detail::win_tss_ptr<class boost::asio::detail::call_stack<class boost::asio::detail::win_iocp_io_service,struct boost::asio::detail::win_iocp_thread_info>::context>::win_tss_ptr
boost::asio::detail::win_tss_ptr<class boost::asio::detail::call_stack<class boost::asio::detail::strand_service::strand_impl,unsigned char>::context>::win_tss_ptr

When I put a breakpoint into the constructor, I see, that both instances seem to be global variables

> xxx.dll!boost::asio::detail::win_tss_ptr_create() Line 40 C++
                xxx.dll!boost::asio::detail::win_tss_ptr<boost::asio::detail::call_stack<boost::asio::detail::win_iocp_io_service,boost::asio::detail::win_iocp_thread_info>::context>::win_tss_ptr<boost::asio::detail::call_stack<boost::asio::detail::win_iocp_io_service,boost::asio::detail::win_iocp_thread_info>::context>() Line 42 + 0x3a bytes C++
                xxx.dll!boost::asio::detail::tss_ptr<boost::asio::detail::call_stack<boost::asio::detail::win_iocp_io_service,boost::asio::detail::win_iocp_thread_info>::context>::tss_ptr<boost::asio::detail::call_stack<boost::asio::detail::win_iocp_io_service,boost::asio::detail::win_iocp_thread_info>::context>() + 0xf bytes C++
               xxx.dll!`dynamic initializer for 'boost::asio::detail::call_stack<boost::asio::detail::win_iocp_io_service,boost::asio::detail::win_iocp_thread_info>::top_''() Line 165 + 0xd bytes C++
               msvcr80d.dll!_initterm(void (void)* * pfbegin=0x101c43a0, void (void)* * pfend=0x101ce9c0) Line 855 C
               xxx.dll!_CRT_INIT(void * hDllHandle=0x10000000, unsigned long dwReason=0x00000001, void * lpreserved=0x00000000) Line 316 + 0xf bytes C
               xxx.dll!__DllMainCRTStartup(void * hDllHandle=0x10000000, unsigned long dwReason=0x00000001, void * lpreserved=0x00000000) Line 492 + 0x11 bytes C
               xxx.dll!_DllMainCRTStartup(void * hDllHandle=0x10000000, unsigned long dwReason=0x00000001, void * lpreserved=0x00000000) Line 462 + 0x11 bytes C

Does anyone on this list has an idea, why the destructors aren't called?

Thanks in advance,

Mario Klebsch

--
Mario Klebsch                      Actia I+ME GmbH
Mario.klebsch_at_[hidden]<mailto:Mario.klebsch_at_[hidden]>         Dresdenstrasse 17/18
Fon: +49 531 38 701 716            38124 Braunschweig
Fax: +49 531 38 701 88            Germany


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