v3-0001-Use-the-allocated-space-properly-for-custom-s-v18.patch
text/plain
Filename: v3-0001-Use-the-allocated-space-properly-for-custom-s-v18.patch
Type: text/plain
Part: 1
Patch
Format: format-patch
Series: patch v3-0001
Subject: Use the allocated space properly for custom stats kind
| File | + | − |
|---|---|---|
| src/backend/utils/activity/pgstat_shmem.c | 3 | 3 |
From f6787781026c7dcf6c9a38b0e7f8c8427a7b2da6 Mon Sep 17 00:00:00 2001 From: Michael Paquier <michael@paquier.xyz> Date: Mon, 6 Apr 2026 09:47:02 +0900 Subject: [PATCH v3] Use the allocated space properly for custom stats kind --- src/backend/utils/activity/pgstat_shmem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c index 08ec264baa3a..2b7f783ef7c4 100644 --- a/src/backend/utils/activity/pgstat_shmem.c +++ b/src/backend/utils/activity/pgstat_shmem.c @@ -142,8 +142,7 @@ StatsShmemSize(void) continue; Assert(kind_info->shared_size != 0); - - sz += MAXALIGN(kind_info->shared_size); + sz = add_size(sz, MAXALIGN(kind_info->shared_size)); } return sz; @@ -227,7 +226,8 @@ StatsShmemInit(void) int idx = kind - PGSTAT_KIND_CUSTOM_MIN; Assert(kind_info->shared_size != 0); - ctl->custom_data[idx] = ShmemAlloc(kind_info->shared_size); + ctl->custom_data[idx] = p; + p += MAXALIGN(kind_info->shared_size); ptr = ctl->custom_data[idx]; } -- 2.53.0