[Gc] Finalization cycle involving Tcl_DString?

Bruce Hoult bruce at hoult.org
Sun Jan 13 01:13:50 PST 2008

On Jan 13, 2008 7:02 PM, S M Ryan <wyrmwif at rawbw.com> wrote:
> I am allocating a finalised Tcl_DString (finalisation tells Tcl to
> release the string)
>         Tcl_DString *ds = GC_NEW(Tcl_DString);
>         Tcl_DStringInit(ds);
>         GC_REGISTER_FINALIZER(ds, releaseDString, 0, &ofn, &ocd);
> I was wondering if anyone can guess what the issue is? Is that the
> allocated block contents can have a pointer into itself?

Yes.  Don't create a finalizer in that case. It's pointless anyway, right?

More information about the Gc mailing list