> Right. But the problem is that TLS usually contains private user structures.
> These need to be released *just before* hread exists. This is why Tcl has
> introduced thread exit handlers.

I agree. I wasn't addressing that problem.  You described two separate
memory leaks in March.  I was simply pointing out that one was fixed
correctly in 3.3.1.

> I'd suggest adding new AOL API functions, something like
> Ns_CreateThreadExitHandler and Ns_CancelThreadExitHandler
> which would then be used instead of the Tcl standard
> Tcl_CreateThreadExitHandler() function.

Tcl_FinalizeThread does some other things besides calling thread exit
handlers.  It would be nice to actually call it.

Since FreeDataBlock is used to free all the Tcl TLS blocks, we could
have FreeDataBlock detect whether Tcl_FinalizeThread has been called,
and call it if it hasn't been.

Reply via email to