<i>Threaded allocator cannot be disabled in Tcl 9: -DUSE_THREAD_ALLOC=0 and nmake OPTS=tclalloc ignored</i> status still Open with 6 other changes
by
.
D 2026-10-20T20:42:12.292
J assignee aku
J closer nobody
J comment In\sTcl\s9\sthere\sis\sno\sway\sto\sbuild\swithout\sthe\sthreaded\s("zippy")\sallocator,\sother\sthan\s<tt>PURIFY</tt>\sor\s<tt>TCL_MEM_DEBUG</tt>.\sAsking\sfor\sit\sexplicitly\sis\ssilently\signored:\r\n\r\n<verbatim>\r\nCFLAGS="-O2\s-DUSE_THREAD_ALLOC=0"\s../unix/configure\s&&\smake\r\nnm\stclThreadAlloc.o\s|\sgrep\s'\sT\sTclpAlloc'\s\s\s\s#\sfound:\szippy\sis\scompiled\sin\r\nnm\stclAlloc.o\s|\sgrep\s'\sT\s'\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s#\sempty\r\n</verbatim>\r\n\r\nExpected:\s<tt>tclThreadAlloc.c</tt>\scompiles\sthe\sstub,\sand\s<tt>TclpAlloc</tt>\scomes\sfrom\s<tt>tclAlloc.c</tt>\s(system\s<tt>malloc()</tt>).\r\n\r\nCause:\s<tt>generic/tclInt.h</tt>\shas\r\n\r\n<verbatim>\r\n#if\sTCL_THREADS\s&&\s!defined(USE_THREAD_ALLOC)\r\n#\s\s\sdefine\sUSE_THREAD_ALLOC\s1\r\n#endif\r\n</verbatim>\r\n\r\nand\severy\suser\s(<tt>tclInt.h</tt>,\s<tt>tclAlloc.c</tt>,\s<tt>tclThreadAlloc.c</tt>,\s<tt>tclBasic.c</tt>,\s<tt>tclEvent.c</tt>,\s<tt>tclThread.c</tt>,\s<tt>unix/tclUnixThrd.c</tt>,\s<tt>win/tclWinThrd.c</tt>)\stests\s<tt>defined(USE_THREAD_ALLOC)</tt>,\snot\sits\svalue.\sSo\s<tt>-DUSE_THREAD_ALLOC=0</tt>\smeans\s"on",\sand\sleaving\sit\sundefined\salso\smeans\s"on".\sThe\sdefault\swas\sadded\sin\s[f2c996cdb8]\s(2018),\swhen\s<tt>configure</tt>\sstopped\sdefining\s<tt>USE_THREAD_ALLOC=1</tt>.\r\n\r\nThe\ssame\sapplies\sto\sthe\sWindows\sbuild:\s<tt>nmake\s-f\smakefile.vc\sOPTS=tclalloc</tt>\ssets\s<tt>USE_THREAD_ALLOC\s=\s0</tt>\sin\s<tt>win/rules.vc</tt>,\sbut\s<tt>/DUSE_THREAD_ALLOC</tt>\sis\spassed\sonly\swhen\s<tt>TCL_VERSION\s<\s87</tt>,\sso\sfor\sTcl\s9\snothing\sreaches\sthe\scompiler\sand\s<tt>tclInt.h</tt>\sturns\sthe\sallocator\son\s(found\sby\sreading\s<tt>rules.vc</tt>,\snot\stested\son\sWindows).\sIn\s8.6\s<tt>OPTS=tclalloc</tt>\sdoes\swork.\r\n\r\nIn\s8.6\son\sUnix,\s<tt>configure</tt>\salways\sadds\s<tt>-DUSE_THREAD_ALLOC=1</tt>\sfor\sthreaded\sbuilds,\swhich\sis\sthe\sold\sRFE\s[1079199fff];\sthe\sworkaround\sthere\s(removing\sit\sfrom\s<tt>Makefile</tt>\sand\s<tt>tclConfig.sh</tt>)\sdoes\snot\sapply\sto\s9.x,\swhere\sthere\sis\snothing\sto\sremove.\r\n\r\nSeen\swith\s9.0.5\sand\smain\s(9.1).\sPossible\sfix:\sin\s<tt>tclInt.h</tt>,\s<tt>#undef</tt>\s<tt>USE_THREAD_ALLOC</tt>\swhen\sit\sis\sdefined\sas\s0,\sand\slet\s<tt>rules.vc</tt>\spass\s<tt>/DUSE_THREAD_ALLOC=0</tt>\sfor\s<tt>OPTS=tclalloc</tt>.
J icomment This\sapparently\swas\san\soversight,\sit\sshould\sbe\spossible\sto\soverride\sthis.\r\n\r\n+1.\sPatch\slooks\sgood\sto\sme.\sCan\sbe\smerged.
J login jan.nijtmans
J mimetype text/x-fossil-wiki
K 31294d48efe6ead48dcd44677774b026045d5cb6
U jan.nijtmans
Z c23710d15075369e1e443a6af26d4772