pg_buffercache: Fix memory allocation formula
authorMichael Paquier <[email protected]>
Thu, 11 Dec 2025 05:11:06 +0000 (14:11 +0900)
committerMichael Paquier <[email protected]>
Thu, 11 Dec 2025 05:11:06 +0000 (14:11 +0900)
commit3f83de20ba2e1d4bd557d92b3436ca04b7c947a8
treebd79d8ee575a7911af0e1e70da27874a8118439a
parent1362bc33e025fd2848ff38558f5672e2f0f0c7de
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 <[email protected]>
Discussion: https://postgr.es/m/ad0748d4-3080-436e-b0bc-ac8f86a3466a@gmail.com
Backpatch-through: 18
contrib/pg_buffercache/pg_buffercache_pages.c