It's possible to predict how much memory the PostgreSQL server is expected to allocate given the server parameters. A table labeled Configuration parameters affecting PostgreSQL's shared memory usage near the bottom of https://www.postgresql.org/docs/10/static/kernel-resources.htm gives a rough estimate (last updated as of Version 8.3) of how much shared memory is allocated by the server. It looks like this:
Usage |
Approximate shared memory bytes |
Connections |
(1800 + 270 * max_locks_per_transaction) * max_connections |
Autovacuum max workers |
(1800 + 270 * max_locks_per_transaction) * autovacuum_max_workers |
Prepared transactions |
(770 + 270 * max_locks_per_transaction) * max_prepared_transactions ... |