Re: "TLS exhausted"; need help interpreting output from DUMP-THREAD

Douglas Katzman via Sbcl-help <[email protected]> Fri, 14 Mar 2025 19:50:52 -0400
Newsgroups gmane.lisp.steel-bank.general
Message-ID <CAOrNasyoC9sMWaE1dv9MvycL69vtf9ySbZTvzJ-C5fE-XL_9zA@mail.gmail.com>
On Fri, Mar 14, 2025 at 5:15 PM Robert Dodier <[email protected]>
wrote:

>
> Is there a way to LET-bind a special variable in some way other than
> thread-locally?
>
> Not really. It could be emulated quite expensively as assignment to
sb-ext:symbol-global-value, presumably wrapped by an unwind-protect to
unbind it no matter how the form is exited.


>
>  Is there a way to know what are the symbols which have been
> allocated thread-local slots?
>
> Take a look at the function I added in
https://sourceforge.net/p/sbcl/sbcl/ci/84bd6884dda719158a46e014e4e48d2ac18fd5f3/
You'll have to paste it in and compile while in-package sb-vm. Notice the
result before and after (gc) of some uninterned let-bound (well, progv)
symbols.
The function can't identify the symbols that are responsible for wasted
indices; that would be cool, but such output would have to occur in GC
before the symbols are gone.

* (dotimes (i 50) (progv (list (make-symbol (format nil "*MYSYM~D*" i)))
'(foo)))
NIL
* (show-all-tls-indexed-symbols)
   10 *BINDING-STACK-POINTER*
...
  E60 #:*MYSYM49*
Wasted indices:
    9B   128   15F   160
NIL
* (gc)
NIL
* (show-all-tls-indexed-symbols)
   10 *BINDING-STACK-POINTER*
...
  CD0 SB-IMPL::*STREAMS-CLOSED-BY-SLAD*
Wasted indices:
    9B   128   15F   160   19B   19C   19D   19E
   19F   1A0   1A1   1A2   1A3   1A4   1A5   1A6
   1A7   1A8   1A9   1AA   1AB   1AC   1AD   1AE
   1AF   1B0   1B1   1B2   1B3   1B4   1B5   1B6
   1B7   1B8   1B9   1BA   1BB   1BC   1BD   1BE
   1BF   1C0   1C1   1C2   1C3   1C4   1C5   1C6
   1C7   1C8   1C9   1CA   1CB   1CC

_______________________________________________
Sbcl-help mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sbcl-help