[Gc] Finalization cycle involving Tcl_DString?

Boehm, Hans hans.boehm at hp.com
Mon Jan 14 17:32:27 PST 2008


In cases in which you really do need to finalize an object that references itself, there is also GC_REGISTER_FINALIZER_IGNORE_SELF, which just ignores dependencies on itself.

However, it's always good advice to avoid finalization when you can.

Hans

> -----Original Message-----
> From: gc-bounces at napali.hpl.hp.com
> [mailto:gc-bounces at napali.hpl.hp.com] On Behalf Of Bruce Hoult
> Sent: Sunday, January 13, 2008 1:14 AM
> To: S M Ryan
> Cc: Boehm-gc
> Subject: Re: [Gc] Finalization cycle involving Tcl_DString?
>
> 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?
> _______________________________________________
> Gc mailing list
> Gc at linux.hpl.hp.com
> http://www.hpl.hp.com/hosted/linux/mail-archives/gc/
>



More information about the Gc mailing list