From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21863 invoked by alias); 24 Jan 2007 19:33:56 -0000 Received: (qmail 21643 invoked by uid 22791); 24 Jan 2007 19:33:53 -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:33:44 +0000 Received: from Debian-exim by zigzag.lvk.cs.msu.su with spam-scanned (Exim 4.50) id 1H9nsE-0005cm-EJ for gdb-patches@sources.redhat.com; Wed, 24 Jan 2007 22:33:40 +0300 Received: from localhost ([127.0.0.1] helo=ip6-localhost) by zigzag.lvk.cs.msu.su with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.50) id 1H9nsD-0005bV-W4 for gdb-patches@sources.redhat.com; Wed, 24 Jan 2007 22:33:34 +0300 From: Vladimir Prus To: gdb-patches@sources.redhat.com Subject: [mi] kill release_value calls Date: Wed, 24 Jan 2007 19:33:00 -0000 User-Agent: KMail/1.9.1 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_KS7tFICaGmugTXT" Message-Id: <200701242233.30910.ghost@cs.msu.su> 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/msg00503.txt.bz2 --Boundary-00=_KS7tFICaGmugTXT Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 449 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? - Volodya * varobj.c (c_value_of_root, c_value_of_child) (cplus_value_of_child): Don't call release_value. --Boundary-00=_KS7tFICaGmugTXT Content-Type: text/x-diff; charset="us-ascii"; name="release_value__gdb_mainline.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="release_value__gdb_mainline.diff" Content-length: 1380 --- gdb/varobj.c (/mirrors/gdb_mainline) (revision 3220) +++ gdb/varobj.c (/patches/gdb/release_value/gdb_mainline) (revision 3220) @@ -1985,13 +1985,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; } @@ -2003,8 +1998,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; } @@ -2338,9 +2331,6 @@ cplus_value_of_child (struct varobj *par name = name_of_child (parent, index); gdb_value_struct_elt (NULL, &value, &temp, NULL, name, NULL, "cplus_structure"); - if (value != NULL) - release_value (value); - xfree (name); } else if (index >= TYPE_N_BASECLASSES (type)) @@ -2368,7 +2358,6 @@ cplus_value_of_child (struct varobj *par if (temp != NULL) { value = value_cast (TYPE_FIELD_TYPE (type, index), temp); - release_value (value); } else { --Boundary-00=_KS7tFICaGmugTXT--