pgsql: pg_buffercache: Fix memory allocation formula

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: pg_buffercache: Fix memory allocation formula
Date: 2025-12-11 05:12:21
Message-ID: E1vTYyS-00060r-0a@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

pg_buffercache: Fix memory allocation formula

The code over-allocated the memory required for os_page_status, relying
on uint64 for its element size instead of an int, hence doubling what
was required. This could mean quite a lot of memory if dealing with a
lot of NUMA pages.

Oversight in ba2a3c2302f1.

Author: David Geier <geidav(dot)pg(at)gmail(dot)com>
Discussion: https://postgr.es/m/ad0748d4-3080-436e-b0bc-ac8f86a3466a@gmail.com
Backpatch-through: 18

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3f83de20ba2e1d4bd557d92b3436ca04b7c947a8

Modified Files
--------------
contrib/pg_buffercache/pg_buffercache_pages.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2025-12-11 05:30:19 pgsql: Use palloc_object() and palloc_array(), the last change
Previous Message Amit Kapila 2025-12-11 03:59:08 pgsql: Enhance slot synchronization API to respect promotion signal.