[Gc] Registering TLS as roots

Ben Hutchings ben.hutchings at businesswebsoftware.com
Fri Oct 15 08:39:30 PDT 2004


Normally thread-local storage (TLS) aka thread-specific storage (TSS)
is not treated as part of the root set.  However I don't see any
general way to store copies of pointers in TLS in places that are in
the root set.

I know how to find TLS on Windows NT on x86 (it's in the TEB structure
defined in <winternl.h> and that can be found through fs:[18h]) and I
can probably look up details of other TLS implementations but this sort
of platform-specific hackery doesn't seem like the best solution.

Does anybody have any suggestions for how to include TLS in the root
set or how to keep extra copies of such pointers elsewhere (and only
so long as they are also in TLS)?

Ben.


More information about the Gc mailing list