pgsql: Fix MemoryContextAllocAligned's interaction with Valgrind.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Fix MemoryContextAllocAligned's interaction with Valgrind.
Дата
Msg-id E1uiO1p-000So3-2i@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix MemoryContextAllocAligned's interaction with Valgrind.

Arrange that only the "aligned chunk" part of the allocated space is
included in a Valgrind vchunk.  This suppresses complaints about that
vchunk being possibly lost because PG is retaining only pointers to
the aligned chunk.  Also make sure that trailing wasted space is
marked NOACCESS.

As a tiny performance improvement, arrange that MCXT_ALLOC_ZERO zeroes
only the returned "aligned chunk", not the wasted padding space.

In passing, fix GetLocalBufferStorage to use MemoryContextAllocAligned
instead of rolling its own implementation, which was equally broken
according to Valgrind.

Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/285483.1746756246@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9e9190154ef204a4e814dcc99f763398f7094667

Modified Files
--------------
src/backend/storage/buffer/localbuf.c |  9 +++---
src/backend/utils/mmgr/alignedalloc.c | 18 ++++++++++++
src/backend/utils/mmgr/mcxt.c         | 54 +++++++++++++++++++++--------------
3 files changed, 56 insertions(+), 25 deletions(-)


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