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

BOOL TlsFree(DWORD dwTlsIndex); 


  • dwTlsIndex
    Specifies a TLS index that was allocated by the TlsAlloc function.

Return Values

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 TlsFree function does not free any dynamic storage that has been associated with the TLS index. It is expected that DLLs call this function (if at all) only during their process detach routine.

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


Runs on Versions Defined in Include Link to
Windows CE OS 1.0 and later Winbase.h   Coremain.lib

Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

GetLastError, TlsAlloc, TlsGetValue, TlsSetValue

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.