From: Vladimir Prus <ghost@cs.msu.su>
To: Nick Roberts <nickrob@snap.net.nz>
Cc: Daniel Jacobowitz <drow@false.org>, gdb-patches@sources.redhat.com
Subject: Re: [PATCH] MI: Free values when updating
Date: Tue, 23 Jan 2007 21:35:00 -0000 [thread overview]
Message-ID: <200701240034.52325.ghost@cs.msu.su> (raw)
In-Reply-To: <17846.31726.382269.143176@kahikatea.snap.net.nz>
On Wednesday 24 January 2007 00:19, Nick Roberts wrote:
> > > I think if you also remove the (3) calls to release_value in
> > > c_value_of_child and cplus_value_of_child this is equivalent to my change
> > > (and more tidy).
> >
> > No, those are different. They come from things like the call to
> > gdb_value_ind in c_describe_child. That creates a new value, which is
> > returned to the caller (the MI front end, to be printed and later
> > released). It's the ones in c_value_of_root which matter, because we
> > save them in the varobj.
>
> In varobj_update:
>
> new = value_of_child (v->parent, v->index);
> if (install_new_value (v, new, 0 /* type not changed */))
>
> In create_child:
>
> value = value_of_child (parent, index);
> ...
> install_new_value (child, value, 1);
>
> Now install_new_value calls release_value on new, it's not neeeded in
> *_value_of_child.
I think that's right. All calls to release_value except in install_new_value can be
removed I believe, and I'll post a patch to that effect tomorrow.
> I've tried this change on the MI testsuite and see no fails
> and it has about the same time improvement that my patch had. If this is not
> the right patch then the testsuite is lacking the appropriate test. Can you
> create a test where this patch fails?
You cannot. For non-reference types, release_value gets called twice, which is
benign now. I'll try adding assert in release_value, though.
For reference and array types, extra release_value gives you a memleak, and
there's nothing that will cause a test to fail due to that.
- Volodya
next prev parent reply other threads:[~2007-01-23 21:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-23 7:45 Nick Roberts
2007-01-23 7:55 ` Vladimir Prus
2007-01-23 8:56 ` Nick Roberts
2007-01-23 9:15 ` Vladimir Prus
2007-01-23 11:02 ` Nick Roberts
2007-01-23 12:12 ` Daniel Jacobowitz
2007-01-23 21:19 ` Nick Roberts
2007-01-23 21:35 ` Vladimir Prus [this message]
2007-01-24 8:00 ` Vladimir Prus
2007-01-24 9:14 ` Nick Roberts
2007-01-24 9:21 ` Vladimir Prus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200701240034.52325.ghost@cs.msu.su \
--to=ghost@cs.msu.su \
--cc=drow@false.org \
--cc=gdb-patches@sources.redhat.com \
--cc=nickrob@snap.net.nz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox