From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx.kolabnow.com (mx.kolabnow.com [212.103.80.155]) by sourceware.org (Postfix) with ESMTPS id BE750385DDC5 for ; Tue, 25 Jun 2024 10:37:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BE750385DDC5 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=lambda.is Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=lambda.is ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BE750385DDC5 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=212.103.80.155 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719311871; cv=none; b=Unuodl9FzYLG1CLRnUgqWaK15+9p4+su9KwUnm+gCzg+/U0ewdAin5SlJAkGB+/a2gNoD76OnqYkkU6hLakagQnbeSnB9Hbj38F9q5/Cdk3m+VbtT81XlYp72XxyW2nY/TIP7aFMtyiTChFQxpLSyiD628kUOqgA+dOg92aItWg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719311871; c=relaxed/simple; bh=Mq1K3i08sH+iSObsEDXj6LF4YKEehQeZzHUd4y2aBMM=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=rgjJbzF/7NiJ4BPg+Xj9cAVxN6pO7A66zhyl6W4i7tibxPkWWMTTdWm/IjGLK2OsrTiOlfVoxCOHS1gMRx/OUy8snX3JUb1rTb6pSgmCp/s6InrH1onMXbJTFQLc5UYaPEhMpOK2zOJSGMGcDDbwBwQDJh/WrRzDDERUPPxqW9s= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost (unknown [127.0.0.1]) by mx.kolabnow.com (Postfix) with ESMTP id 95B5A20D134C; Tue, 25 Jun 2024 12:37:47 +0200 (CEST) Authentication-Results: ext-mx-out011.mykolab.com (amavis); dkim=pass (2048-bit key) reason="pass (just generated, assumed good)" header.d=kolabnow.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kolabnow.com; h= content-transfer-encoding:content-type:content-type:in-reply-to :from:from:content-language:references:subject:subject :mime-version:date:date:message-id:received:received:received; s=dkim20240523; t=1719311862; x=1721126263; bh=gVLD/k/tkTITEwGW dD2/ojOSzr4VRzndF+cfaxESZ8Y=; b=FeOsGdEYB7o0a6lFNFpc76ZwoaAHJQ4G 4k45rVOemhkgymwnnAfb6qJLagVBoyWqdkm6PKr4w4i6HYH+0Ime1MYHi/mUfb2y bdg0np416vyU8pam+BqSl7gZfv87ahD/iuV/pLDVRcBy/l5kQjsBgoF1igs76hI2 M2xpyPwLKvxOU23/KxXV7/PWQ82QwoKzMJqGfNO8j3sl8pye6V0JFGb0YJveiVAv 92eu4gWnguPvsNUx0oDhX2QxZgO8eDkHkU8oy2M7DawPkfOKi8GPFpgzKdXureAV N/MOu15AdF61N/KC0wnQ/jEUZK0NxCSQwiBSnzLL18S6XetGJPeJ1A== X-Virus-Scanned: amavis at mykolab.com X-Spam-Score: -0.999 X-Spam-Level: X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 Received: from mx.kolabnow.com ([127.0.0.1]) by localhost (ext-mx-out011.mykolab.com [127.0.0.1]) (amavis, port 10024) with ESMTP id VE6yNmxU0-D0; Tue, 25 Jun 2024 12:37:42 +0200 (CEST) Received: from int-mx009.mykolab.com (unknown [10.9.13.9]) by mx.kolabnow.com (Postfix) with ESMTPS id 4B69220D1348; Tue, 25 Jun 2024 12:37:42 +0200 (CEST) Received: from ext-subm010.mykolab.com (unknown [10.9.6.10]) by int-mx009.mykolab.com (Postfix) with ESMTPS id 0949621F0939; Tue, 25 Jun 2024 12:37:42 +0200 (CEST) Message-ID: <45b14137-9596-4054-948d-de07968bea06@lambda.is> Date: Tue, 25 Jun 2024 12:37:41 +0200 MIME-Version: 1.0 Subject: Re: [PATCH 1/3] Release structures on function return To: Jan Hubicka Cc: gcc-patches@gcc.gnu.org References: <20240625080332.1517736-1-j@lambda.is> <20240625080332.1517736-2-j@lambda.is> Content-Language: en-US From: =?UTF-8?Q?J=C3=B8rgen_Kvalsvik?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 6/25/24 12:23, Jan Hubicka wrote: >> The value vec objects are destroyed on exit, but release still needs to >> be called explicitly. >> >> gcc/ChangeLog: >> >> * tree-profile.cc (find_conditions): Release vectors before >> return. > I wonder if you turn > hash_map, vec> exprs; > to > hash_map, auto_vec> exprs; > Won't hash_map destructor take care of this by itself? It does, actually - I think I tried something to that effect at one point and the auto_vec's non-copy semantics got in the way. Apparently I either misremember trying, or I did something differently at the time. auto_vec is much nicer, of course, I'll update the patch. Thanks! > > Honza >> --- >> gcc/tree-profile.cc | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/gcc/tree-profile.cc b/gcc/tree-profile.cc >> index e4bb689cef5..18f48e8d04e 100644 >> --- a/gcc/tree-profile.cc >> +++ b/gcc/tree-profile.cc >> @@ -919,6 +919,9 @@ find_conditions (struct function *fn) >> if (!have_post_dom) >> free_dominance_info (fn, CDI_POST_DOMINATORS); >> >> + for (auto expr : exprs) >> + expr.second.release (); >> + >> cov->m_masks.safe_grow_cleared (2 * cov->m_index.last ()); >> const size_t length = cov_length (cov); >> for (size_t i = 0; i != length; i++) >> -- >> 2.39.2 >>