Artifacts Associated With Ticket 31294d48efe6ead4
Ticket change [56877ba7f3] (rid 258529) by serhiy.storchaka on 2026-10-17 10:51:11:
- cmimetype initialized to: "text/x-fossil-wiki"
- comment initialized to:
In Tcl 9 there is no way to build without the threaded ("zippy") allocator, other than <tt>PURIFY</tt> or <tt>TCL_MEM_DEBUG</tt>. Asking for it explicitly is silently ignored: <verbatim> CFLAGS="-O2 -DUSE_THREAD_ALLOC=0" ../unix/configure && make nm tclThreadAlloc.o | grep ' T TclpAlloc' # found: zippy is compiled in nm tclAlloc.o | grep ' T ' # empty </verbatim> Expected: <tt>tclThreadAlloc.c</tt> compiles the stub, and <tt>TclpAlloc</tt> comes from <tt>tclAlloc.c</tt> (system <tt>malloc()</tt>). Cause: <tt>generic/tclInt.h</tt> has <verbatim> #if TCL_THREADS && !defined(USE_THREAD_ALLOC) # define USE_THREAD_ALLOC 1 #endif </verbatim> and every user (<tt>tclInt.h</tt>, <tt>tclAlloc.c</tt>, <tt>tclThreadAlloc.c</tt>, <tt>tclBasic.c</tt>, <tt>tclEvent.c</tt>, <tt>tclThread.c</tt>, <tt>unix/tclUnixThrd.c</tt>, <tt>win/tclWinThrd.c</tt>) tests <tt>defined(USE_THREAD_ALLOC)</tt>, not its value. So <tt>-DUSE_THREAD_ALLOC=0</tt> means "on", and leaving it undefined also means "on". The default was added in [f2c996cdb8] (2018), when <tt>configure</tt> stopped defining <tt>USE_THREAD_ALLOC=1</tt>. The same applies to the Windows build: <tt>nmake -f makefile.vc OPTS=tclalloc</tt> sets <tt>USE_THREAD_ALLOC = 0</tt> in <tt>win/rules.vc</tt>, but <tt>/DUSE_THREAD_ALLOC</tt> is passed only when <tt>TCL_VERSION < 87</tt>, so for Tcl 9 nothing reaches the compiler and <tt>tclInt.h</tt> turns the allocator on (found by reading <tt>rules.vc</tt>, not tested on Windows). In 8.6 <tt>OPTS=tclalloc</tt> does work. In 8.6 on Unix, <tt>configure</tt> always adds <tt>-DUSE_THREAD_ALLOC=1</tt> for threaded builds, which is the old RFE [1079199fff]; the workaround there (removing it from <tt>Makefile</tt> and <tt>tclConfig.sh</tt>) does not apply to 9.x, where there is nothing to remove. Seen with 9.0.5 and main (9.1). Possible fix: in <tt>tclInt.h</tt>, <tt>#undef</tt> <tt>USE_THREAD_ALLOC</tt> when it is defined as 0, and let <tt>rules.vc</tt> pass <tt>/DUSE_THREAD_ALLOC=0</tt> for <tt>OPTS=tclalloc</tt>. - foundin initialized to: "9.0.5, 9.1.0"
- login: "serhiy.storchaka"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- subsystem initialized to: "41. Memory Allocation"
- title initialized to:
Threaded allocator cannot be disabled in Tcl 9: -DUSE_THREAD_ALLOC=0 and nmake OPTS=tclalloc ignored
- type initialized to: "Bug"
Ticket change [41af45dba3] (rid 258603) by serhiy.storchaka on 2026-10-17 13:04:57:
- icomment:
Proposed fix in branch [/timeline?r=thread-alloc-off-switch|thread-alloc-off-switch]: <tt>tclInt.h</tt> undefines <tt>USE_THREAD_ALLOC</tt> when it is defined as 0, and <tt>win/rules.vc</tt> passes <tt>/DUSE_THREAD_ALLOC=0</tt> for <tt>OPTS=tclalloc</tt> with Tcl 9. Both a Unix build with <tt>CFLAGS=-DUSE_THREAD_ALLOC=0</tt> and an nmake build with <tt>OPTS=tclalloc</tt> now get <tt>TclpAlloc</tt> from tclAlloc.c, and pass the tests.
- login: "serhiy.storchaka"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [608196f32c] (rid 259535) by serhiy.storchaka on 2026-10-20 18:11:29:
- submitter changed to: "serhiy.storchaka"
Ticket change [612a6abf63] (rid 259578) by jan.nijtmans on 2026-10-20 20:42:12:
- assignee changed to: "aku"
- closer changed to: "nobody"
- comment changed to:
In Tcl 9 there is no way to build without the threaded ("zippy") allocator, other than <tt>PURIFY</tt> or <tt>TCL_MEM_DEBUG</tt>. Asking for it explicitly is silently ignored: <verbatim> CFLAGS="-O2 -DUSE_THREAD_ALLOC=0" ../unix/configure && make nm tclThreadAlloc.o | grep ' T TclpAlloc' # found: zippy is compiled in nm tclAlloc.o | grep ' T ' # empty </verbatim> Expected: <tt>tclThreadAlloc.c</tt> compiles the stub, and <tt>TclpAlloc</tt> comes from <tt>tclAlloc.c</tt> (system <tt>malloc()</tt>). Cause: <tt>generic/tclInt.h</tt> has <verbatim> #if TCL_THREADS && !defined(USE_THREAD_ALLOC) # define USE_THREAD_ALLOC 1 #endif </verbatim> and every user (<tt>tclInt.h</tt>, <tt>tclAlloc.c</tt>, <tt>tclThreadAlloc.c</tt>, <tt>tclBasic.c</tt>, <tt>tclEvent.c</tt>, <tt>tclThread.c</tt>, <tt>unix/tclUnixThrd.c</tt>, <tt>win/tclWinThrd.c</tt>) tests <tt>defined(USE_THREAD_ALLOC)</tt>, not its value. So <tt>-DUSE_THREAD_ALLOC=0</tt> means "on", and leaving it undefined also means "on". The default was added in [f2c996cdb8] (2018), when <tt>configure</tt> stopped defining <tt>USE_THREAD_ALLOC=1</tt>. The same applies to the Windows build: <tt>nmake -f makefile.vc OPTS=tclalloc</tt> sets <tt>USE_THREAD_ALLOC = 0</tt> in <tt>win/rules.vc</tt>, but <tt>/DUSE_THREAD_ALLOC</tt> is passed only when <tt>TCL_VERSION < 87</tt>, so for Tcl 9 nothing reaches the compiler and <tt>tclInt.h</tt> turns the allocator on (found by reading <tt>rules.vc</tt>, not tested on Windows). In 8.6 <tt>OPTS=tclalloc</tt> does work. In 8.6 on Unix, <tt>configure</tt> always adds <tt>-DUSE_THREAD_ALLOC=1</tt> for threaded builds, which is the old RFE [1079199fff]; the workaround there (removing it from <tt>Makefile</tt> and <tt>tclConfig.sh</tt>) does not apply to 9.x, where there is nothing to remove. Seen with 9.0.5 and main (9.1). Possible fix: in <tt>tclInt.h</tt>, <tt>#undef</tt> <tt>USE_THREAD_ALLOC</tt> when it is defined as 0, and let <tt>rules.vc</tt> pass <tt>/DUSE_THREAD_ALLOC=0</tt> for <tt>OPTS=tclalloc</tt>. - icomment:
This apparently was an oversight, it should be possible to override this. +1. Patch looks good to me. Can be merged.
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
Ticket change [24a0b59dfb] (rid 259591) by serhiy.storchaka on 2026-10-20 21:09:33:
- login: "serhiy.storchaka"
- resolution changed to: "Fixed"
- status changed to: "Closed"
Ticket change [2ed956f18c] (rid 259599) by serhiy.storchaka on 2026-10-20 21:14:09:
- icomment:
Merged to [8a323cc288|trunk] and [26d3effbc6|core-9-0-branch].
- login: "serhiy.storchaka"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [d5e16fc98f] (rid 259616) by jan.nijtmans on 2026-10-20 21:26:21:
- closedate changed to: "2461334.3933068058"
- closer changed to: "jan.nijtmans"
- icomment: "Please don't forget the changes.md/changes entries"
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"