Summary
The pg_shmem_allocations view shows allocations made from the server’s main shared memory segment. This includes both memory allocated by PostgreSQL itself and memory allocated by extensions using the mechanisms detailed in xfunc_shared_addin.
(Description quoted from the official PostgreSQL documentation.)
Columns
The pg_shmem_allocations system view exposes the following columns (names, types and descriptions are taken verbatim from the PostgreSQL documentation):
nametext
The name of the shared memory allocation. NULL for unused memory and <anonymous> for anonymous allocations.offint8
The offset at which the allocation starts. NULL for anonymous allocations, since details related to them are not known.sizeint8
Size of the allocation in bytesallocated_sizeint8
Size of the allocation in bytes including padding. For anonymous allocations, no information about padding is available, so the size and allocated_size columns will always be equal. Padding is not meaningful for free memory, so the columns will be equal in that case also.
Version applicability
Present in PostgreSQL 17, 18, 19 (verified against each release’s documentation). This is a long-standing system object that also exists in earlier PostgreSQL releases.
Related & references
Reference: PostgreSQL documentation — pg_shmem_allocations.