pgsql: Fix shmem allocation of fixed-sized custom stats kind - Mailing list pgsql-committers

From Michael Paquier
Subject pgsql: Fix shmem allocation of fixed-sized custom stats kind
Date
Msg-id E1w9wgq-003KJq-1m@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix shmem allocation of fixed-sized custom stats kind

StatsShmemSize(), that computes the shmem size needed for pgstats,
includes the amount of shared memory wanted by all the custom stats
kinds registered.  However, the shared memory allocation was done by
ShmemAlloc() in StatsShmemInit(), meaning that the space reserved was
not used, wasting some memory.

These extra allocations would show up under "<anonymous>" in
pg_shmem_allocations, as the allocations done by ShmemAlloc() are not
tracked by ShmemIndexEnt.

Issue introduced by 7949d9594582.

Author: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://postgr.es/m/04b04387-92f5-476c-90b0-4064e71c5f37@iki.fi
Backpatch-through: 18

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/93f08dc92cf822b9f9dc1ef5cd815b04c65e8718

Modified Files
--------------
src/backend/utils/activity/pgstat_shmem.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)


pgsql-committers by date:

Previous
From: Amit Langote
Date:
Subject: pgsql: Fix deferred FK check batching introduced by commit b7b27eb41a5
Next
From: Michael Paquier
Date:
Subject: pgsql: Fix injection point detach timing problem in TAP test for lock s