# shared memory issue?



## minimike (Jul 23, 2011)

hi there,

I want to have a jail with PostgreSQL running inside. The Database should use a shared buffer with 1024 MB memory. So I've calculated 1024 MB + 128 MB = 1152 MB to be sure that it will enough. That are 1207959552 Bytes

In /etc/sysctl.conf I've also written


```
security.jail.sysvipc_allowed=1
kern.ipc.shmall=65536
kern.ipc.shmmax=1207959552
kern.ipc.semmap=4194304
kern.ipc.shm_use_phys=1
```

On the jail in /usr/local/pgsql/data/postgresql.conf I've added the entry 

```
shared_buffers = 1024MB
```

But PostgreSQL fails to start and give me this message on its logfile


```
DETAIL:  Failed system call was shmget(key=5432001, size=1113710592, 03600).
HINT:  This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory or swap space, or exceeded your
 kernel's SHMALL parameter.  You can either reduce the request size or reconfigure the kernel with larger SHMALL.  To reduce the request size
 (currently 1113710592 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections.
	The PostgreSQL documentation contains more information about shared memory configuration.
```

FreeBSD 9 Current and PostgreSQL 9 with support for LDAP and Heimdal compiled.

many thanks for advance


----------



## Alt (Jul 23, 2011)

Look at ipcs output, probably you should clean IPCs with ipcrm command


----------



## minimike (Jul 23, 2011)

Update

Is it correct that I've to calculate for SHMALL in kilobyte and for SHMMAX in byte?

here my updated /etc/sysctl.conf

```
# 1152 MB
# 1179648 kb
kern.ipc.shmall=1179648
# 1207959552 byte
kern.ipc.shmmax=1207959552
```

I'm not sure that I've did everything right.


```
freebsd-one# ipcs -M
shminfo:
	shmmax:   1207959552	(max shared memory segment size)
	shmmin:            1	(min shared memory segment size)
	shmmni:          192	(max number of shared memory identifiers)
	shmseg:          128	(max shared memory segments per process)
	shmall:      1179648	(max amount of shared memory in pages)

freebsd-one#
```

cheers
Darko


----------

