Following my recent query about reference counting (thanks again for the responses), I feel that I should have access to the 'memory' command,
which I see means that I need to define TCL_MEM_DEBUG at compile time.
That immediately raises two questions:
i) Exactly how do I do that?
I expect that I need to specify something when I run configure.
Maybe something like
configure --define=TCL_MEM_DEBUG --prefix=<wherever>
but I can't find what exactly.
ii) Will I need to recompile all the binary extensions I use?
If not, I plan to build and install Tcl with the symbol defined,
rename tclsh9.1 to tclsh-mem9.1 with a tclsh-mem softlink pointing
to it, then re-install a "standard" Tcl in the same directory with a
tclsh softlink. This would let me do tclsh to run a "standard" shell
and tclsh-mem to run a shell that supports 'memory'.
If I would need to recompile the binary extensions, then I guess I
need two parallel directories. I suppose I can get away with putting
the tclsh-mem softlink in the "standard" directory and only have a
single entry in PATH.
Many thanks
Alan
Following my recent query about reference counting (thanks again for the responses), I feel that I should have access to the 'memory' command,
which I see means that I need to define TCL_MEM_DEBUG at compile time.
That immediately raises two questions:
i) Exactly how do I do that?
I expect that I need to specify something when I run configure.
Maybe something like
configure --define=TCL_MEM_DEBUG --prefix=<wherever>
but I can't find what exactly.
ii) Will I need to recompile all the binary extensions I use?
If not, I plan to build and install Tcl with the symbol defined,
rename tclsh9.1 to tclsh-mem9.1 with a tclsh-mem softlink pointing
to it, then re-install a "standard" Tcl in the same directory with a
tclsh softlink. This would let me do tclsh to run a "standard" shell
and tclsh-mem to run a shell that supports 'memory'.
If I would need to recompile the binary extensions, then I guess I
need two parallel directories. I suppose I can get away with putting
the tclsh-mem softlink in the "standard" directory and only have a
single entry in PATH.
Many thanks
Alan
Following my recent query about reference counting (thanks again for the responses), I feel that I should have access to the 'memory' command,--- Synchronet 3.22a-Linux NewsLink 1.2
which I see means that I need to define TCL_MEM_DEBUG at compile time.
That immediately raises two questions:
Am 15.10.2026 um 20:30 schrieb Alan Grunwald:
Following my recent query about reference counting (thanks again for
the responses), I feel that I should have access to the 'memory'
command, which I see means that I need to define TCL_MEM_DEBUG at
compile time. That immediately raises two questions:
i) Exactly how do I do that?
I expect that I need to specify something when I run configure.
Maybe something like
configure --define=TCL_MEM_DEBUG --prefix=<wherever>
but I can't find what exactly.
ii) Will I need to recompile all the binary extensions I use?
If not, I plan to build and install Tcl with the symbol defined,
rename tclsh9.1 to tclsh-mem9.1 with a tclsh-mem softlink pointing >> to it, then re-install a "standard" Tcl in the same directory with a
tclsh softlink. This would let me do tclsh to run a "standard" shell
and tclsh-mem to run a shell that supports 'memory'.
If I would need to recompile the binary extensions, then I guess I >> need two parallel directories. I suppose I can get away with putting
the tclsh-mem softlink in the "standard" directory and only have a >> single entry in PATH.
Many thanks
Alan
Yes, aparently, it is an official feature:
https://www.tcl-lang.org/man/tcl9.1/TclLib/TCL_MEM_DEBUG.html
On MS-Win, the head of the make file has comment how to use it (opts=MEM_DEBUG).
But the file unix\README contains the information:
How I understand it:
--enable-symbols=mem
But the instructions are unclear to me.
Room for improvement on the man page and help files...
Sorry,
Harald
On Unix/MinGW
configure --enable-symbols=mem ....
With nmake,
nmake /f makefile.vc STATS=memdbg ....
On 10/16/2026 12:00 AM, Alan Grunwald wrote:
Following my recent query about reference counting (thanks again for
the responses), I feel that I should have access to the 'memory'
command, which I see means that I need to define TCL_MEM_DEBUG at
compile time. That immediately raises two questions:
i) Exactly how do I do that?
I expect that I need to specify something when I run configure.
Maybe something like
configure --define=TCL_MEM_DEBUG --prefix=<wherever>
but I can't find what exactly.
ii) Will I need to recompile all the binary extensions I use?
If not, I plan to build and install Tcl with the symbol defined,
rename tclsh9.1 to tclsh-mem9.1 with a tclsh-mem softlink pointing >> to it, then re-install a "standard" Tcl in the same directory with a
tclsh softlink. This would let me do tclsh to run a "standard" shell
and tclsh-mem to run a shell that supports 'memory'.
If I would need to recompile the binary extensions, then I guess I >> need two parallel directories. I suppose I can get away with putting
the tclsh-mem softlink in the "standard" directory and only have a >> single entry in PATH.
Many thanks
Alan
BTW, I am not sure whether compiling Tcl with memory debugging enabled requires any loaded extensions to also have been compiled the same way. Probably safer to do so.
On 16/10/2026 13:06, Ashok wrote:
BTW, I am not sure whether compiling Tcl with memory debugging enabled requires any loaded extensions to also have been compiled the same way. Probably safer to do so.
I agree it would be safer.
FWIW, I'm intending only to use the memory-enabled shell to exercise/debug my homebrew extension and I'm fairly sure that none of the scripts that I'm using it with rely on any other binary extensions. I'm planning to see what happens when I run my extension without rebuilding it[*]. If I don't come back here to report otherwise, you can assume that I had no problems.
Alan
[*] Come to think of it, I rather think I _will_ have to recompile my extension to be sure that my own calls to the framework use the TCL_MEM_DEBUG versions of things. Watch this space!
| Sysop: | DaiTengu |
|---|---|
| Location: | Appleton, WI |
| Users: | 1,142 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 93:10:59 |
| Calls: | 14,704 |
| Calls today: | 2 |
| Files: | 186,497 |
| D/L today: |
2,369 files (785M bytes) |
| Messages: | 2,551,657 |