Re: free C string

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Zhihong Yu <zyu(at)yugabyte(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: free C string
Date: 2021-07-14 19:36:59
Message-ID: 3562506.1626291419@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Zhihong Yu <zyu(at)yugabyte(dot)com> writes:
> On Wed, Jul 14, 2021 at 10:17 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> There's really very little point in adding such code. Our memory
>> context mechanisms take care of minor leaks like this, with less
>> code and fewer cycles expended than explicit pfree calls require.
>> It's worth trying to clean up explicitly in code that might get
>> executed many times in a row, or might be allocating very big
>> temporary chunks; but fmgr_internal_validator hardly falls in
>> that category.

> How about this occurrence which is in a loop ?

I'd say the burden is on you to prove that it's worth worrying
about, not vice versa. If we added pfree everywhere we possibly
could, the code would be larger and slower, not faster.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ibrar Ahmed 2021-07-14 19:39:52 Re: Remove page-read callback from XLogReaderState.
Previous Message Ibrar Ahmed 2021-07-14 19:35:18 Re: [PATCH] Partial foreign key updates in referential integrity triggers