Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wgmHh-006OQ3-0y for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Jul 2026 16:35:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wgmHg-001k8E-02 for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Jul 2026 16:35:04 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wgmHf-001k85-0V for pgsql-hackers@lists.postgresql.org; Mon, 06 Jul 2026 16:35:03 +0000 Received: from fout-a3-smtp.messagingengine.com ([103.168.172.146]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wgmHc-00000001sHF-2X6b for pgsql-hackers@postgresql.org; Mon, 06 Jul 2026 16:35:02 +0000 Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.phl.internal (Postfix) with ESMTP id 66349EC0107; Mon, 6 Jul 2026 12:34:59 -0400 (EDT) Received: from phl-imap-15 ([10.202.2.104]) by phl-compute-05.internal (MEProxy); Mon, 06 Jul 2026 12:34:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=partin.io; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1783355699; x=1783442099; bh=taWm7ygOSj+NS9QJHG8l73c2CE1eli5MfQLGRTEE74s=; b= JNTAUMR9/VllqMhgjr0X4PVQfQvNcHbWqsTeqC25Bpc3b5FIwKr/a/5Nvs/xCMc+ ijjAHFOROainKUUnLM0dh0tfB2eXFEDR6dpcwPPO1nDx+5dd2MvtYv9FHKHWn+Or dFR0b6PSWJEZfixjCwV+aG4Skh7YyzGsaaghX0GykWIXpKv2sST3FkkkeW2APS/1 ZXgAbD2jO1EHQMXN6N272vLtlon1s0PCc516ktgkYJc99zsX1EGM6hhHy3NIId6R QgYgeq/Jhfb6oy0ETR/QmhJmsWXaQWEHaGqUY1aLuCa1W4wmajZj8v8gtShllvB9 5F+BiQXBdlgjIwMG8TMTFA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1783355699; x= 1783442099; bh=taWm7ygOSj+NS9QJHG8l73c2CE1eli5MfQLGRTEE74s=; b=O CXaDwnCUH5HDcGSTX2EaxhyBLAVG/lpcq9E/WMdk5bWKfYZM4p+2lzwI5PCiQGUf iBB6rhNRcRKPivEUV9GdKbBLW4qjPVx/+c0cTHzok9/hgFsfhn6M3nxaWN/KOSZd BmMwRB50Rjdg6VyOsjawnqZJXKXZrv3UR4DCmymjHys8mOAw0DwpH2koWYUAgKU4 OcBSOsY3ehqG/KK46iiThzrujhblboel/XdUpasMQ7+54lHnDT709hsjgQeZFDD/ M9rWhQQYrOM8976FxZ/YejRL21ZIqP9WWLK1a200oBmAzzc9TjwagX5jQfEP400+ 88YY4bZRwMim7aaBGOPeQ== X-ME-Sender: X-ME-Proxy-Cause: dmFkZTGSFvBS8kV7WdBmfW88p9bD1zpQ1u47YRw4fXOVSG/VIvD2qpV3C0tCnWBfQOT8iR aHFwbU5x6ClMCbZAnusquhaQ3AC/rN94/fOpH/cYmeYnjMQvDQ1ZRvG2k7ZD8U089UwBuN FMr9lyRX6Cn+TRF+7s4FAI4+wPAVNnxFBoGMW6g1iE4I17UzJYsHd0x+gRnDgXld1xTkTK va5wQ0+xldMQNEsB/aNUk2+oexMIxoRxuSRdNZGNDeznCJZ7bhbRANvQBQIfdrdhPJeEGS yZH0QcsbpZyox8nP2hCr5Ik6+jsdH+qln233gOCcwc2I11duHAMK5QfPkwZSXRBBKhDam/ wik+EbxfkC1aR+LWEHJROnRGz6+EEdOjx7POA6ep0z6184ogqAWRFOwDea5EAPt2JRlM+N mKOeUXNzOaXD10b7FxRp1jEWsHiK8T2E9jHPOKllmLQ4UdwYyTnGo/OyYyY2xo5AqVUINK JTroAO/gPrCcyZcd/GpdU0PhDn0cl/Ad30MViP0EWpVFYy0mJGO9Zqyi1zJHQLPhfmSddf 4eAAmGKYqG5Hr/rXTmK8owrt7yzk/+1v9GOBuvnCE8OqTxdmQE74V4HsUWrKVtCvjQo8XU 4kpXRrJeEiB93Cs02f3EI+R9xC6zS2s5cD80B+pEUsJOM2thEEHcC4JRGNzg X-ME-Proxy: Feedback-ID: idd01497b:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 0D57F780AB5; Mon, 6 Jul 2026 12:34:59 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Mon, 06 Jul 2026 16:34:58 +0000 Message-Id: Cc: "pgsql-hackers" Subject: Re: Add malloc attribute to memory allocation functions To: "Tom Lane" From: "Tristan Partin" X-Mailer: aerc 0.21.0 References: <924283.1783312014@sss.pgh.pa.us> In-Reply-To: <924283.1783312014@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon Jul 6, 2026 at 4:26 AM UTC, Tom Lane wrote: > "Tristan Partin" writes: >> Given that we now have a tree that compiles fine against=20 >> -Werror=3Dmismatched-dealloc, we need to make sure that we don't regress= .=20 >> By adding the malloc attribute[0], we can protect against regressions,= =20 >> enable more accurate code coverage with -fanalyzer, and allow the=20 >> compiler to do some optimizations. > > I'm skeptical that this is going to lead to anything but grief. > In particular, since gcc has never heard of memory contexts, > I don't see how we are not going to get buried in bogus > -Wanalyzer-malloc-leak warnings. It doesn't really help > to add compiler annotations that only sort-of match our semantics. > > (This opinion is based on years of dismissing useless Coverity > warnings of this kind.) This is a fair criticism. On master, the number of=20 -Wanalyzer-malloc-leak warnings is 62. With this patch applied, it=20 balloons to 598. --=20 Tristan Partin PostgreSQL Contributors Team AWS (https://aws.amazon.com)