On 07.04.26 00:01, Jacob Champion wrote:
>>> Or else make pfree() behave like free() [2] so that we don't
>>> have to have that particular papercut at all anymore?
>>
>> -many
>>
>> It's also not a path I want to add any unnecessary instructions to.
>
> Okay, but I'd be curious to know how widespread this position is.
This was recently (as in: I still remember it) discussed:
https://www.postgresql.org/message-id/flat/cf26e970-8e92-59f1-247a-aa265235075b%40enterprisedb.com
Probably not worth opening up again.
But it seems to me that the pfree() in fe_memutils.c should
Assert(pointer != NULL), to be consistent with the backend version.
I've also been thinking sometimes about a pfree_if_nonnull() (which
would do { if (ptr) pfree(ptr)) }. That would in some cases make the
notation more compact and robust. Maybe it could help here too?