Re: Add malloc attribute to memory allocation functions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, Tristan Partin <tristan(at)partin(dot)io>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add malloc attribute to memory allocation functions
Date: 2026-07-07 23:54:06
Message-ID: 1885662.1783468446@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Michael Paquier <michael(at)paquier(dot)xyz> writes:
> Additional question. Does this help with requirements like the one
> listed in fe-exec.c for PQfreemem() under WIN32?

Yeah, I was wondering about that point too. It would be really nice
to have automated checks for that. Maybe the right thing to do here
(to start anyway) is to put in targeted annotations that address
specific pain points like that one.

One issue that'd have to be dealt with is that that would involve
putting annotations into the public header file libpq-fe.h. We'd need
to be sure we do not break things for applications using compilers
other than what we built libpq with. That seems reasonably easy to do
with some macro trickery, but it's a point to keep in mind.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tristan Partin 2026-07-07 23:57:23 Re: Add malloc attribute to memory allocation functions
Previous Message Alexander Korotkov 2026-07-07 23:49:45 Re: SPLIT/MERGE use of is_internal=true