agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: Fix shmem allocation of fixed-sized custom stats kind
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix shmem allocation of fixed-sized custom stats kind
@ 2026-04-07 03:01  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Paquier @ 2026-04-07 03:01 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/17132f55c5a2c04743edec20655cc7123ce08713

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Fix shmem allocation of fixed-sized custom stats kind
@ 2026-04-07 03:01  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Paquier @ 2026-04-07 03:01 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-04-07 03:01 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-04-07 03:01 pgsql: Fix shmem allocation of fixed-sized custom stats kind Michael Paquier <michael@paquier.xyz>
2026-04-07 03:01 pgsql: Fix shmem allocation of fixed-sized custom stats kind Michael Paquier <michael@paquier.xyz>

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