agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix shmem allocation of fixed-sized custom stats kind
Date: Tue, 07 Apr 2026 03:01:21 +0000
Message-ID: <E1w9wgq-003KJq-1m@gemulon.postgresql.org> (raw)

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(-)



view thread (2+ messages)

Message-ID: <E1w9wgq-003KJq-1m@gemulon.postgresql.org>
Permalink:  ../E1w9wgq-003KJq-1m@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1w9wgq-003KJq-1m@gemulon.postgresql.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix shmem allocation of fixed-sized custom stats kind
  In-Reply-To: <E1w9wgq-003KJq-1m@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox