Re: Reducing the chunk header sizes on all memory context types

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: Reducing the chunk header sizes on all memory context types
Дата
Msg-id CAApHDvrFo-dyjBLEfnZ50cT1AecWXhz71MzScy5CvVt7qP1niw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Reducing the chunk header sizes on all memory context types  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
On Wed, 13 Jul 2022 at 05:42, Andres Freund <andres@anarazel.de> wrote:
> > There is at least one. It might be major; to reduce the AllocSet chunk
> > header from 16 bytes down to 8 bytes I had to get rid of the freelist
> > pointer that was reusing the "aset" field in the chunk header struct.
> > This works now by storing that pointer in the actual palloc'd memory.
> > This could lead to pretty hard-to-trace bugs if we have any code that
> > accidentally writes to memory after pfree.
>
> Can't we use the same trick for allcations in the freelist as we do for the
> header in a live allocation? I.e. split the 8 byte header into two and use
> part of it to point to the next element in the list using the offset from the
> start of the block, and part of it to indicate the size?

That can't work as the next freelist item might be on some other block.

David



В списке pgsql-hackers по дате отправления:

Предыдущее
От: David Rowley
Дата:
Сообщение: Re: Reducing the chunk header sizes on all memory context types
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Reducing the chunk header sizes on all memory context types