Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-07-20 09:58:14


Anthony Williams wrote:
> "Peter Dimov" <pdimov_at_[hidden]> writes:
>
>> I've attached a proposed simplification of
>> libs/thread/src/tss_hooks.cpp that eliminates the one-time
>> allocation that's been bugging people because their tools report it
>> as a leak.
>>
>> If there are no objections, I'll commit this change to the CVS HEAD.
>
> Can we have a call to TlsFree in on_process_exit, so we don't leak
> the TLS slot either?

It's better not to. We don't leak a TLS slot because TLS slots are per
process. When the process is terminated by the OS, all of its TLS slots are
"reclaimed" (more precisely, they simply cease to exist.)

So we gain nothing because the lack of TlsFree is not observable.

On the other hand, if on_process_exit is called when some threads are still
running, TlsFree'ing the slot will make it impossible for these threads to
clean up after themselves since they won't be able to access their cleanup
handler lists. This can be observable if their cleanup handlers have visible
side effects.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk