This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Value reference counting
On Monday 20 July 2009 Daniel Jacobowitz wrote:
> On Mon, Jul 20, 2009 at 10:13:35AM +0400, Vladimir Prus wrote:
> > > + /* The number of references to this value. This initially includes
> > > + one reference from the value chain; if release_value is called,
> > > + it converts that into a normal reference. */
> > > + int reference_count;
> > > };
> >
> > I do not fully understand this comment, specifically the "it converts
> > that into a normal reference". What is "it", what is "that" and what
> > is "normal reference" and where the convention happens? From your email,
> > I gather it's intentional that release_value does not have to be changed,
> > but I don't understand anything else :-( I am sure it's just me, but
> > a better comment would be good.
>
> "It" is release_value, and "that" is the one reference. Is this
> clearer?
>
> /* The number of references to this value. When a value is created,
> the value chain holds a reference, so REFERENCE_COUNT is 1. If
> release_value is called, this value is removed from the chain but
> the caller of release_value now has a reference to this value.
> The caller must arrange for a call to value_free later. */
Thank you, this is now crystal clear!
- Volodya