From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B9A0F3858D32; Mon, 30 Jan 2023 23:22:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B9A0F3858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675120976; bh=a/h9B2ZgA1RdprH7U64cuKjFjyYqf2IdKHfSW2ZFM9s=; h=From:To:Subject:Date:In-Reply-To:References:From; b=RYt37K5Tec+yUtU6N02Pw6OssVvaGA0doRp10C95PaSW4Mb5NR4gNhgnKapMgdwGH 7khEJnKVc+BxULwjcVX91zGbNNnzg+W0p9Wl+Xm8w7RIX+Q3mGe1mY+SFAGNAwXgP/ D45ozvcVZpF5tQIqEdailLl8W+8SBurduUqm316s= From: "tromey at sourceware dot org" To: gdb-prs@sourceware.org Subject: [Bug python/30044] Flawed logic when releasing values from all_values buffer Date: Mon, 30 Jan 2023 23:22:56 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: python X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: tromey at sourceware dot org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D30044 --- Comment #7 from Tom Tromey --- It seems to me that there are two competing wishes here. On the one hand, removing values from the chain was done to avoid memory issues. Suppose you have a command written in Python and it does a lot of value-based processing. Formerly, nothing ever cleared these values from the chain until the command returned. So, you could wind up allocating huge amounts of memory. See bug #12533 On the other hand, code should not generally care if a value API returns a new value or not. This came up for value_cast but it could be anywhere. Actually there's also a third issue, which is that the Python layer can end up freeing values from the chain while they are still in use. For item 3 I suspect the best answer is to use value_ref_ptr everywhere. That way code will generally have a strong reference to any value it uses. This is pretty large. For items 1 and 2 I wonder if it would work for each Python Value API to do use scoped_value_mark at the start. The idea here is that any new values created would be released from the chain, but older ones would not be. In conjunction with this, value_to_value_object would stop releasing values from the chain. --=20 You are receiving this mail because: You are on the CC list for the bug.=