From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 326 invoked by alias); 24 Jan 2007 19:55:46 -0000 Received: (qmail 318 invoked by uid 22791); 24 Jan 2007 19:55:45 -0000 X-Spam-Check-By: sourceware.org Received: from zigzag.lvk.cs.msu.su (HELO zigzag.lvk.cs.msu.su) (158.250.17.23) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 24 Jan 2007 19:55:41 +0000 Received: from Debian-exim by zigzag.lvk.cs.msu.su with spam-scanned (Exim 4.50) id 1H9oDU-0007Q4-Dt for gdb-patches@sources.redhat.com; Wed, 24 Jan 2007 22:55:37 +0300 Received: from localhost ([127.0.0.1] helo=ip6-localhost) by zigzag.lvk.cs.msu.su with esmtp (Exim 4.50) id 1H9oDI-0007Pj-6z; Wed, 24 Jan 2007 22:55:20 +0300 From: Vladimir Prus Subject: Re: [mi] kill release_value calls To: Daniel Jacobowitz , gdb-patches@sources.redhat.com Date: Wed, 24 Jan 2007 19:55:00 -0000 References: <200701242233.30910.ghost@cs.msu.su> <20070124194009.GA23437@nevyn.them.org> User-Agent: KNode/0.10.2 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart2414857.Mj86rG5e1m" Content-Transfer-Encoding: 7Bit Message-Id: Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-01/txt/msg00506.txt.bz2 --nextPart2414857.Mj86rG5e1m Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8Bit Content-length: 663 Daniel Jacobowitz wrote: > On Wed, Jan 24, 2007 at 10:33:30PM +0300, Vladimir Prus wrote: >> >> This patch removes all calls to release_value in varobj.c, except >> for one. We only need to call release_value when we're storing >> a value for indefinite future use, and install_new_value is the >> only such place. The extra release_value calls either >> are time-consuming no-ops, or lead to memory leaks, >> depending on the value type. >> >> OK? > > OK. My apologies to Nick - I'd told him this was wrong, but I was > mistaken. Here's what I've checked in -- I had to adjust the patch for the changes I've checked to mainline earlier today. - Volodya --nextPart2414857.Mj86rG5e1m Content-Type: text/x-diff; name="release_value_as_committed.diff" Content-Transfer-Encoding: 8Bit Content-Disposition: attachment; filename="release_value_as_committed.diff" Content-length: 1754 Index: ChangeLog =================================================================== RCS file: /cvs/src/src/gdb/ChangeLog,v retrieving revision 1.8137 diff -u -p -r1.8137 ChangeLog --- ChangeLog 24 Jan 2007 13:37:05 -0000 1.8137 +++ ChangeLog 24 Jan 2007 19:53:01 -0000 @@ -1,3 +1,8 @@ +2007-01-24 Vladimir Prus + + * varobj.c (c_value_of_root, c_value_of_child) + (cplus_describe_child): Don't call release_value. + 2007-01-24 Thiemo Seufer * mips-linux-tdep.c (mips_linux_n64_rt_sigframe): Fix struct Index: varobj.c =================================================================== RCS file: /cvs/src/src/gdb/varobj.c,v retrieving revision 1.81 diff -u -p -r1.81 varobj.c --- varobj.c 24 Jan 2007 11:08:47 -0000 1.81 +++ varobj.c 24 Jan 2007 19:53:02 -0000 @@ -2020,13 +2020,8 @@ c_value_of_root (struct varobj **var_han if (within_scope) { /* We need to catch errors here, because if evaluate - expression fails we just want to make val->error = 1 and - go on */ - if (gdb_evaluate_expression (var->root->exp, &new_val)) - { - release_value (new_val); - } - + expression fails we want to just return NULL. */ + gdb_evaluate_expression (var->root->exp, &new_val); return new_val; } @@ -2038,8 +2033,6 @@ c_value_of_child (struct varobj *parent, { struct value *value = NULL; c_describe_child (parent, index, NULL, &value, NULL); - if (value != NULL) - release_value (value); return value; } @@ -2304,7 +2297,6 @@ cplus_describe_child (struct varobj *par if (cvalue && value) { *cvalue = value_cast (TYPE_FIELD_TYPE (type, index), value); - release_value (*cvalue); } if (ctype) --nextPart2414857.Mj86rG5e1m--