I am trying to debug some shared memory issues with Postgres 9.3.1 and CentOS release 6.3 (Final). I have a database machine that probably has some misconfigured shared memory settings. It's getting into 2+ GB of swap. Restarting postgres frees all of the memory, but after a few hours of normal usage it will go back into swap. During light usage, postgres will *very* slowly release some memory, but not all. Using top, I can see that many of the postgres connections are using shared memory:
There are about 29 total idle connections. `sudo ipcs -m` only shows:
```
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x0052e2c1 163840 postgres 600 48 21
```
Surprisingly, it only shows it using 48 bytes. Any ideas why that would be?
My shared memory settings are:
kernel.shmmax = 8589934592 # 8 GB
kernel.shmall = 2097152 # * 4096 = 8 GB
kernel.shmmni = 4096
Do I need to set lower shared memory limits? In the past, I've run into issues using pg_dump and executing larger transactions with lower values. If I can monitor the shared memory segment I can better understand when postgres is allocating and releasing..