This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Value reference counting


On Friday 17 July 2009 Daniel Jacobowitz wrote:

>         * value.c (struct value): Add reference_count field.
>         (allocate_value_lazy): Initialize reference_count.
>         (value_incref): New function.
>         (value_free): Check the reference count.
>         * value.h (value_incref): New prototype.
> 
> ---
>  gdb/value.c |   27 +++++++++++++++++++++++++++
>  gdb/value.h |    2 ++
>  2 files changed, 29 insertions(+)
> 
> Index: src/gdb/value.c
> ===================================================================
> --- src.orig/gdb/value.c        2009-07-17 09:52:16.000000000 -0400
> +++ src/gdb/value.c     2009-07-17 10:07:10.000000000 -0400
> @@ -194,6 +194,11 @@ struct value
>    /* Actual contents of the value.  Target byte-order.  NULL or not
>       valid if lazy is nonzero.  */
>    gdb_byte *contents;
> +
> +  /* 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.

- Volodya



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]