[GRASS5] NVIZ and threaded TCL 8.4 working
Hamish
hamish_nospam at yahoo.com
Wed Mar 15 01:27:51 EST 2006
> > Many of the nviz c source files call Tcl_Merge to make return
> > strings, and assign them to interp->result where interp is the TCL
> > interpreter like this:
> >
> > interp->result = Tcl_Merge(3, list);
> >
> > Then they set the freeProc ("function" to call to free the memory)
> > to be free (glibc). Tcl_Merge allocates its memory with Tcl_Alloc,
> > not with malloc. Before 8.4 Tcl_Alloc just happened to be malloc,
> > but it's not anymore. The correct thing to do is to set the
> > freeProc to be TCL_DYNAMIC, which will be TCL's opposite of
> > Tcl_Alloc, like this:
> >
> > interp->freeProc = TCL_DYNAMIC;
>
> Will this also work in 8.3?
fwiw, on Debian/stable with tcl8.3-dev, tcl8.4-dev, and tk8.4-dev installed:
$ grep -r TCL_DYNAMIC /usr/include/tcl8.* | cut -f4- -d'/'
tcl8.3/tcl-private/generic/tcl.h: * statically allocated. TCL_DYNAMIC means
tcl8.3/tcl-private/generic/tcl.h:#define TCL_DYNAMIC ((Tcl_FreeProc *) 3)
tcl8.3/tcl-private/generic/tclInt.h: * allocated. TCL_DYNAMIC means string
tcl8.3/tcl.h: * statically allocated. TCL_DYNAMIC means
tcl8.3/tcl.h:#define TCL_DYNAMIC ((Tcl_FreeProc *) 3)
tcl8.4/tcl-private/generic/tcl.h: * statically allocated. TCL_DYNAMIC means
tcl8.4/tcl-private/generic/tcl.h:#define TCL_DYNAMIC ((Tcl_FreeProc *) 3)
tcl8.4/tcl-private/generic/tclInt.h: * allocated. TCL_DYNAMIC means string
tcl8.4/tcl.h: * statically allocated. TCL_DYNAMIC means
tcl8.4/tcl.h:#define TCL_DYNAMIC ((Tcl_FreeProc *) 3)
Today's gold star goes to Cedric.
Hamish
More information about the grass-dev
mailing list