Re: Possible bug in Tcl.pm exposed by Tktable?

[email protected] (Christopher Chavez) Mon, 16 Mar 2020 04:09:15 -0500
Newsgroups perl.tcltk
Message-ID <[email protected]>

On 3/16/2020 3:48 AM, Christopher Chavez wrote:
> The addresses involved are inside allocations from Tcl's thread block
> cache, which I'm guessing could be heavily reused over the life of a Tcl
> program (to minimize direct calls to malloc()). I'll ask Tcl developers,
> but is anyone here aware of a way to disable this or make it
> debugging-friendly to identify what the last user of the block is?

To partially answer my own question:
there are some compile-time techniques to try like -DPURIFY
https://wiki.tcl-lang.org/page/How+to+debug+memory+faults+in+Tcl+and+extensions

That page mentioned the Tcl exit command, which I've never used
from Perl. Adding it completely prevents the error:


     use Tcl;
     my $i = new Tcl;
     $i->Init;
     $i->Eval(<<'EOS');

     package require Tk
     package require Tktable
     destroy .
     exit

     EOS


But should things like destroying the root window and Tcl exit really
be necessary to prevent errors during normal usage?

Christopher A. Chavez