|
2026-10-20
| ||
| 21:26 | • Ticket [31294d48ef] Threaded allocator cannot be disabled in Tcl 9: -DUSE_THREAD... artifact: d5e16fc98f user: jan.nijtmans | |
| 21:14 | • Ticket [31294d48ef]: 3 changes artifact: 2ed956f18c user: serhiy.storchaka | |
| 21:11 | Fix [31294d48ef]: Threaded allocator cannot be disabled in Tcl 9: -DUSE_THREAD_ALLOC=0 and nmake OPT... check-in: 26d3effbc6 user: serhiy.storchaka tags: core-9-0-branch | |
| 21:09 | • Closed ticket [31294d48ef]: Threaded allocator cannot be disabled in Tcl 9: -DUS... artifact: 24a0b59dfb user: serhiy.storchaka | |
| 21:08 | Fix [31294d48ef]: Threaded allocator cannot be disabled in Tcl 9: -DUSE_THREAD_ALLOC=0 and nmake OPT... check-in: 8a323cc288 user: serhiy.storchaka tags: trunk, main | |
| 20:42 | • Ticket [31294d48ef] Threaded allocator cannot be disabled in Tcl 9: -DUSE_THREAD... artifact: 612a6abf63 user: jan.nijtmans | |
| 18:11 | • Ticket [31294d48ef]: 1 change artifact: 608196f32c user: serhiy.storchaka | |
|
2026-10-17
| ||
| 13:04 | • Ticket [31294d48ef]: 3 changes artifact: 41af45dba3 user: serhiy.storchaka | |
| 12:57 | Fix [31294d48ef]: the threaded allocator could not be disabled in Tcl 9: -DUSE_THREAD_ALLOC=0 was tr... closed check-in: 8fd0f583a9 user: serhiy.storchaka tags: thread-alloc-off-switch | |
| 10:51 | • New ticket [31294d48ef] Threaded allocator cannot be disabled in Tcl 9: -DUSE_TH... artifact: 56877ba7f3 user: serhiy.storchaka | |
Threaded allocator cannot be disabled in Tcl 9: -DUSE_THREAD_ALLOC=0 and nmake OPTS=tclalloc ignored
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
Expected: tclThreadAlloc.c compiles the stub, and TclpAlloc comes from tclAlloc.c (system malloc()).
Cause: generic/tclInt.h has
#if TCL_THREADS && !defined(USE_THREAD_ALLOC) # define USE_THREAD_ALLOC 1 #endif
and every user (tclInt.h, tclAlloc.c, tclThreadAlloc.c, tclBasic.c, tclEvent.c, tclThread.c, unix/tclUnixThrd.c, win/tclWinThrd.c) tests defined(USE_THREAD_ALLOC), not its value. So -DUSE_THREAD_ALLOC=0 means "on", and leaving it undefined also means "on". The default was added in [f2c996cdb8] (2018), when configure stopped defining USE_THREAD_ALLOC=1.
The same applies to the Windows build: nmake -f makefile.vc OPTS=tclalloc sets USE_THREAD_ALLOC = 0 in win/rules.vc, but /DUSE_THREAD_ALLOC is passed only when TCL_VERSION < 87, so for Tcl 9 nothing reaches the compiler and tclInt.h turns the allocator on (found by reading rules.vc, not tested on Windows). In 8.6 OPTS=tclalloc does work.
In 8.6 on Unix, configure always adds -DUSE_THREAD_ALLOC=1 for threaded builds, which is the old RFE [1079199fff]; the workaround there (removing it from Makefile and tclConfig.sh) does not apply to 9.x, where there is nothing to remove.
Seen with 9.0.5 and main (9.1). Possible fix: in tclInt.h, #undef USE_THREAD_ALLOC when it is defined as 0, and let rules.vc pass /DUSE_THREAD_ALLOC=0 for OPTS=tclalloc.
26d3effbc6Fix [31294d48ef]: Threaded allocator cannot be disabled in Tcl 9: -DUSE_THREAD_ALLOC=0 and nmake OPTS=tclalloc ignored check-in2026-10-20 21:11:418a323cc288Fix [31294d48ef]: Threaded allocator cannot be disabled in Tcl 9: -DUSE_THREAD_ALLOC=0 and nmake OPTS=tclalloc ignored check-in2026-10-20 21:08:598fd0f583a9Fix [31294d48ef]: the threaded allocator could not be disabled in Tcl 9: -DUSE_THREAD_ALLOC=0 was treated as defined, and nmake OPTS=tclalloc passed nothing. Undefine USE_THREAD_ALLOC when it is 0, and pass /DUSE_THREAD_ALLOC=0 for OPTS=tclalloc. check-in2026-10-17 12:57:12
Proposed fix in branch thread-alloc-off-switch: tclInt.h undefines USE_THREAD_ALLOC when it is defined as 0, and win/rules.vc passes /DUSE_THREAD_ALLOC=0 for OPTS=tclalloc with Tcl 9. Both a Unix build with CFLAGS=-DUSE_THREAD_ALLOC=0 and an nmake build with OPTS=tclalloc now get TclpAlloc from tclAlloc.c, and pass the tests.
This apparently was an oversight, it should be possible to override this.
+1. Patch looks good to me. Can be merged.
Merged to [trunk] and [core-9-0-branch].
Please don't forget the changes.md/changes entries