From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id IaOyG/C/+2g8jAYAWB0awg (envelope-from ) for ; Fri, 24 Oct 2025 14:05:36 -0400 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=SzazGlwu; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 6AD971E04C; Fri, 24 Oct 2025 14:05:36 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id E8B391E04C for ; Fri, 24 Oct 2025 14:05:35 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A8F1E3858023 for ; Fri, 24 Oct 2025 18:05:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A8F1E3858023 Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=SzazGlwu Received: from omta036.useast.a.cloudfilter.net (omta036.useast.a.cloudfilter.net [44.202.169.35]) by sourceware.org (Postfix) with ESMTPS id 5D7EF3858C42 for ; Fri, 24 Oct 2025 18:04:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5D7EF3858C42 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5D7EF3858C42 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1761329071; cv=none; b=e0wZdiZ9xQS5r3h2o/jeIXB7d1ZOpBmyqBKeheKHEGWPnOxdoltwYPoYRY8cGc9B3JpV5nStiK9DlxQnuidJDKDiwQ8mJQREr+NH77I+hzgGBDHCNKgsuh5SoM9DQO09bNa0kbp7n7RSfRDdBBSwFpQwtQYfLZlAdgLpqXjKHfI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1761329071; c=relaxed/simple; bh=zGbdR1qMp6WsSYa5vtIH52vfZ82f0AaFsGKr7XnEX8Y=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=u5KBS/6ybfw1WdT/yd74kFtUV5pAQq3pq9q5VjblVubV1KmdKMVtSXfm9n8LBAheMZBfLRYwOXbdtqJ/GDwJJgoZDoZWuA4JqcQ4CgWnEyP6pLcssWL0ZaeM9YLZ9uzUchg0YY7Hw/ieP26FpqvANrvhWlA+gAMi6A4ijZYwpYQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5D7EF3858C42 Received: from eig-obgw-6001b.ext.cloudfilter.net ([10.0.30.143]) by cmsmtp with ESMTPS id CL93vTfX6KXDJCM9Ov8mb1; Fri, 24 Oct 2025 18:04:30 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id CM9CvStB49m9eCM9Cv0FZM; Fri, 24 Oct 2025 18:04:18 +0000 X-Authority-Analysis: v=2.4 cv=eMQTjGp1 c=1 sm=1 tr=0 ts=68fbbfae a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=x6icFKpwvdMA:10 a=ItBw4LHWJt0A:10 a=OP_HwY_12Z-ikTfeoCEA:9 a=VS4QxaUSPT0UtbFnIvSC:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=XpeVcdc4MRzQhsB20GSx+n/rb87krF2nqB8ZunSyHtU=; b=SzazGlwuoh+k6WlMjFM9TEJnUQ 0YxJOFFf1LX5aJG5KsXPbeIIAJ/GFJbN8QietDsehtl4nW1PFE+DuQcclfhgUg+oXzhB03nL3YvCr DDs0BH/SE4nkzOXybpYrInsL4; Received: from 97-122-110-68.hlrn.qwest.net ([97.122.110.68]:46748 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vCM9B-00000003lkI-3hhY; Fri, 24 Oct 2025 12:04:17 -0600 From: Tom Tromey To: Simon Marchi Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [PATCH 2/2] Free multidicts from blockvector In-Reply-To: <42123ec4-5b99-410d-bde1-3b506117cea6@simark.ca> (Simon Marchi's message of "Fri, 24 Oct 2025 12:25:12 -0400") References: <20251023-mdict-free-v1-0-ad02b2bdd549@tromey.com> <20251023-mdict-free-v1-2-ad02b2bdd549@tromey.com> <873479bgdf.fsf@tromey.com> <87ecqsie88.fsf@tromey.com> <42123ec4-5b99-410d-bde1-3b506117cea6@simark.ca> X-Attribution: Tom Date: Fri, 24 Oct 2025 12:04:16 -0600 Message-ID: <871pmsi3bz.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.110.68 X-Source-L: No X-Exim-ID: 1vCM9B-00000003lkI-3hhY X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-110-68.hlrn.qwest.net (bapiya) [97.122.110.68]:46748 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfEjxtzxRwBP/sIQhgT7LxBwLEzxxIbmSFT3PX+RiXU+ySf5UGRwcrx38k5yVQ4QprGmTywMldVn8YJsLGLZUL2jqqBNjwB7rV3rbM3prHIxTUTMYyqpR 707dpj9xh85xwEz8w0lebktylNJ9fFGt/h9DqKN+p6Bkp66Vffe2hnI2craR8Nef/oDWaWkFaQsQvD82iXhtcU33C/jyF/o1s3k= X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Simon> I guess that this restriction of "objects allocated on obstack must be Simon> trivially destructible" is a bit artificial and arbitrary? It is Simon> technically fine to allocate on obstack an object having a destructor, Simon> as long as you ensure the destructor is called at some point. I guess Simon> the restriction was put because it's easy to forget and error prone. I think the specific difference from ordinary 'new' is that valgrind will detect a new-based memory leak, but not an obstack-based leak. So, in the heap case, the leak will also point out that the destructor isn't being run; whereas in the obstack case it could go completely unnoticed. Simon> - There is a ton of blocks created, so it's nice to be able to free Simon> their memory in O(1). Unfortunately, having to free Simon> block::m_multidict means that part is O(n), but the less we have to Simon> do in O(n) the better I guess? We could also track the ownership of the dictionaries separately, e.g. with unordered_set or similar. This would reduce the cost if it matters. Tom