Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-07-17 05:47:59


Daniel Krügler wrote:

> Thanks Peter, for your attachment. A first quick test seems to
> show that the leak detector is quiet now. Interestingly the provided
> code is much simpler than the older one, but does not call
> ::TlsFree anymore (I think it cannot call that function to prevent
> the same problem, which the current mutext attempts to solve).
> I have not found yet any hints in the documentation
> of the TLS functions, whether there have to be a matching ::TlsFree
> for any ::TlsAlloc. Anyone else? Most probably the loss of available
> TLS indices would be worse than a missing clean-up of a mutex, isn't
> it?

TLS indices are per-process, and since the TLS index used by the cleanup
code cannot be cleaned before process exit, it doesn't matter whether there
is an explicit TlsFree. When the process dies, so will all its TLS indices.

I could have put a TlsFree in on_process_exit, but it's better not to. If
on_process_exit is (for some reason) called before all on_thread_exits, the
cleanup handlers won't have a chance to execute and will leak.


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