Skip to content
Tcl Source Code History Of Ticket 31294d48ef
Login

History Of Ticket 31294d48ef

Artifacts Associated With Ticket 31294d48ef

  1. Ticket change [56877ba7f3] (rid 258529) by serhiy.storchaka on 2026-10-17 10:51:11:

    1. cmimetype initialized to: "text/x-fossil-wiki"
    2. 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 &lt; 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>.
      
    3. foundin initialized to: "9.0.5, 9.1.0"
    4. login: "serhiy.storchaka"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. severity initialized to: "Minor"
    8. status initialized to: "Open"
    9. subsystem initialized to: "41. Memory Allocation"
    10. title initialized to:
      Threaded allocator cannot be disabled in Tcl 9: -DUSE_THREAD_ALLOC=0 and nmake OPTS=tclalloc ignored
      
    11. type initialized to: "Bug"
  2. Ticket change [41af45dba3] (rid 258603) by serhiy.storchaka on 2026-10-17 13:04:57:

    1. 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.
      
    2. login: "serhiy.storchaka"
    3. mimetype: "text/x-fossil-wiki"
  3. Ticket change [608196f32c] (rid 259535) by serhiy.storchaka on 2026-10-20 18:11:29:

    1. submitter changed to: "serhiy.storchaka"
  4. Ticket change [612a6abf63] (rid 259578) by jan.nijtmans on 2026-10-20 20:42:12:

    1. assignee changed to: "aku"
    2. closer changed to: "nobody"
    3. 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 &lt; 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>.
      
    4. icomment:
      This apparently was an oversight, it should be possible to override this.
      
      +1. Patch looks good to me. Can be merged.
      
    5. login: "jan.nijtmans"
    6. mimetype: "text/x-fossil-wiki"
  5. Ticket change [24a0b59dfb] (rid 259591) by serhiy.storchaka on 2026-10-20 21:09:33:

    1. login: "serhiy.storchaka"
    2. resolution changed to: "Fixed"
    3. status changed to: "Closed"
  6. Ticket change [2ed956f18c] (rid 259599) by serhiy.storchaka on 2026-10-20 21:14:09:

    1. icomment:
      Merged to [8a323cc288|trunk] and [26d3effbc6|core-9-0-branch].
      
    2. login: "serhiy.storchaka"
    3. mimetype: "text/x-fossil-wiki"
  7. Ticket change [d5e16fc98f] (rid 259616) by jan.nijtmans on 2026-10-20 21:26:21:

    1. closedate changed to: "2461334.3933068058"
    2. closer changed to: "jan.nijtmans"
    3. icomment: "Please don't forget the changes.md/changes entries"
    4. login: "jan.nijtmans"
    5. mimetype: "text/x-fossil-wiki"