On 20/03/2018 05:08, Klebsch, Mario wrote:
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.
How is your process exiting? Global destructors will only be called if execution leaves main/WinMain normally (without calling terminate, abort, _exit, TerminateProcess, throwing an exception, etc) -- and they'll (silently) stop being called if any destructor does throw an exception. Also, unless you are dynamically unloading and reloading the DLL (and dynamically unloading the DLL should trigger the destructors), a *small* TLS slot leak is not that important as they are destroyed when your process exits anyway -- despite annoying AppVerifier. The main thing the checks are there for are if you are leaking TLS slots each time you call a particular method or something.