Am 07.04.2005 um 18:23 schrieb Jeff Hobbs:

I'm not 100% sure, but I think the reinit of the Tcl library was more important than the 100% clean Finalize, but both were considered. I need to make sure that the resetting of init to 0 isn't correct for cases like the browser plugin, where Tcl is constantly fully unloaded and reloaded.


OK. I have written a small progam:

#include <stdio.h>
#include <tcl.h>
int main (int argc, char **argv)
{
    char cmd[128];
    Tcl_Interp *interp;

    /* First try */
    Tcl_FindExecutable(argv[0]);
    interp = Tcl_CreateInterp();
    sprintf(cmd, "set a 1111");
    Tcl_Eval(interp, cmd);
    fprintf(stderr, "%s: %s\n", Tcl_GetNameOfExecutable(),
Tcl_GetStringResult(interp));
    Tcl_DeleteInterp(interp);
    Tcl_Finalize();

    /* Second try */
    Tcl_FindExecutable(argv[0]);
    interp = Tcl_CreateInterp();
    sprintf(cmd, "set a 2222");
    Tcl_Eval(interp, cmd);
    fprintf(stderr, "%s: %s\n", Tcl_GetNameOfExecutable(),
Tcl_GetStringResult(interp));
    Tcl_DeleteInterp(interp);

    Tcl_Exit(0);
}

Compile it and run:

zvpb:~/tmp zoran$ gcc -g -o t a.c -I/usr/local/include -L/usr/local/lib
-ltcl8.4g
zvpb:~/tmp zoran$ gdb ./t
GNU gdb 5.3-20030128 (Apple version gdb-330.1) (Fri Jul 16 21:42:28 GMT
2004)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "powerpc-apple-darwin".
Reading symbols for shared libraries ... done
(gdb) run
Starting program: /Users/zoran/tmp/t
Reading symbols for shared libraries ... done
/Users/zoran/tmp/t: 1111
/Users/zoran/tmp/t: 2222

Program exited normally.

I think this is correct now. What's still left is to check the Windows
port. I do not have Windows at hand unfortunately, but I changed that
part as well. If you can checkout the core-8-4-branch on Windows and
try it out...

The leak is gone, as I already reported.

Cheers
Zoran


-- AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> 
with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to