Prevent shared memory hash tables from growing beyond initial size
Heikki Linnakangas <heikki.linnakangas@iki.fi>
Author:
Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: 2026-04-03T23:40:24Z
Releases:
19 (unreleased)
Prevent shared memory hash tables from growing beyond initial size Set HASH_FIXED_SIZE on all shared memory hash tables, to prevent them from growing after the initial allocation. It was always weirdly indeterministic that if one hash table used up all the unused shared memory, you could not use that space for other things anymore until restart. We just got rid of that behavior for the LOCK and PROCLOCK tables, but it's similarly weird for all other hash tables. Increase SHMEM_INDEX_SIZE because we were already above the max size, on that one, and it's now a hard limit. Some callers of ShmemInitHash() still pass HASH_FIXED_SIZE, but that's now unnecessary. They should perhaps now be removed, but it doesn't do any harm either to pass it. Reviewed-by: Tomas Vondra <tomas@vondra.me> Discussion: https://www.postgresql.org/message-id/01ab1d41-3eda-4705-8bbd-af898f5007f1@iki.fi
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/storage/ipc/shmem.c | modified | +8 −12 |
| src/include/storage/shmem.h | modified | +2 −2 |
Discussion
- Shared hash table allocations 16 messages · 2026-03-27 → 2026-04-03