Re: Expand palloc/pg_malloc API

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Expand palloc/pg_malloc API
Date: 2022-10-11 15:48:33
Message-ID: b12fdb4b-fecb-e768-69a8-f2c4b997e903@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 14.09.22 06:53, Tom Lane wrote:
> I wrote:
>> It kind of feels that the argument order should be pointer, oldsize, size.
>> It feels even more strongly that people will get the ordering wrong,
>> whichever we choose. Is there a way to make that more bulletproof?
>
> Actually ... an even-more-terrifyingly-plausible misuse is that the
> supplied oldsize is different from the actual previous allocation.
> We should try to check that. In MEMORY_CONTEXT_CHECKING builds
> it should be possible to assert that oldsize == requested_size.
> We don't have that data if !MEMORY_CONTEXT_CHECKING, but we could
> at least assert that oldsize <= allocated chunk size.

I'm not very familiar with MEMORY_CONTEXT_CHECKING. Where would one get
these values?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2022-10-11 16:03:48 Re: Make EXPLAIN generate a generic plan for a parameterized query
Previous Message Bruce Momjian 2022-10-11 15:11:39 Re: Warning about using pg_stat_reset() and pg_stat_reset_shared()