This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for

This function releases a thread local storage (TLS) index, making it available for reuse.


BOOL TlsFree(



[in] Specifies a TLS index that was allocated by the TlsAllocfunction.

Return Value

Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.


If the threads of the process have allocated dynamic storage and used the TLS index to store pointers to this storage, they should free the storage before calling TlsFree.

The TlsFreefunction does not free dynamic storage that has been associated with the TLS index.

It is expected that DLLs only call this function during their process detach routine.

For a brief discussion of typical uses of the TLS functions, see the Remarks section of the TlsAllocfunction.


Header winbase.h
Library coredll.lib
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also