Two things about STk.

From: Paul Anderson <>
Date: Fri, 03 Sep 1999 16:32:53 -0400


Two things.

Thing one:
I have come across a bug in the process code. I understand
exactly what is going on and I would be happy to fix it,
but I can't decide what is the best fix.

Here is how to get it:

(define p (run-process "cat" :input :pipe))
(define fp (process-input p))
(set! p 0)
(set! fp 0)

When 'p' gets garbage collected, free_process calls STk_freeport on
all its streams. When fp gets garbage collected STk_freeport
is also called. Thus you are freeing the same port twice.
This can crash, though mostly it doesn't.

In STk_freeport, I could just nullify PORT_NAME(port) and
port->storage_as.port.p. If STk_freeport got called again
I would check to see if these were already null. Does this
sound OK?

Thing two:
When I run purify on an application linked with STk I get lots
of leaks reported. I haven't looked into how easy or
difficult they would be to fix. For example,

         This memory was allocated from:
               malloc [rtlib.o]
               StringCreate [tclHash.c:507]
               STk_add_callback [tk-glue.c:209]
               DoConfig [tkConfig.c:436]
               Tk_ConfigureWidget [tkConfig.c:180]
               Tk_Menu_ConfigureWidget [tkConfig.c:81]
               ConfigureMenuEntry [tkMenu.c:1511]
               MenuAddOrInsert [tkMenu.c:2114]

Also, things like:

   STk_sharp_dot_result(interp, Tk_PathName(butPtr->tkwin));

show up as leaking the string saved to the interp, even though
it is marked as TCL_VOLATILE.

Has there been any work done on this for 4.0, or should I try
and get to it myself?


Paul Anderson. GrammaTech, Inc. Tel: +1 607 273-7340
Received on Fri Sep 03 1999 - 22:34:54 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST