Re: Add bump memory context type and use it for tuplesorts
От | Matthias van de Meent |
---|---|
Тема | Re: Add bump memory context type and use it for tuplesorts |
Дата | |
Msg-id | CAEze2Wh2wPsWwyo_WPZtJttX9moy++OVQvZU67iQQVn9K1En=w@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Add bump memory context type and use it for tuplesorts (David Rowley <dgrowleyml@gmail.com>) |
Ответы |
Re: Add bump memory context type and use it for tuplesorts
|
Список | pgsql-hackers |
On Tue, 20 Feb 2024 at 10:41, David Rowley <dgrowleyml@gmail.com> wrote: > On Tue, 7 Nov 2023 at 07:55, Matthias van de Meent > <boekewurm+postgres@gmail.com> wrote: > > > +++ b/src/backend/utils/mmgr/bump.c > > > +BumpBlockIsEmpty(BumpBlock *block) > > > +{ > > > + /* it's empty if the freeptr has not moved */ > > > + return (block->freeptr == (char *) block + Bump_BLOCKHDRSZ); > > > [...] > > > +static inline void > > > +BumpBlockMarkEmpty(BumpBlock *block) > > > +{ > > > +#if defined(USE_VALGRIND) || defined(CLOBBER_FREED_MEMORY) > > > + char *datastart = ((char *) block) + Bump_BLOCKHDRSZ; > > > > These two use different definitions of the start pointer. Is that deliberate? > > hmm, I'm not sure if I follow what you mean. Are you talking about > the "datastart" variable and the assignment of block->freeptr (which > you've not quoted?) What I meant was that > (char *) block + Bump_BLOCKHDRSZ vs > ((char *) block) + Bump_BLOCKHDRSZ , when combined with my little experience with pointer addition and precedence, and a lack of compiler at the ready at that point in time, I was afraid that "(char *) block + Bump_BLOCKHDRSZ" would be parsed as "(char *) (block + Bump_BLOCKHDRSZ)", which would get different offsets across the two statements. Godbolt has since helped me understand that both are equivalent. Kind regards, Matthias van de Meent
В списке pgsql-hackers по дате отправления: