How to resize shared memory limit on Ubuntu 14.04

Getting current shared memory size

The file /proc/sys/kernel/shmmax contains the shared memory maximum size. The following command displays the shared memory current size:

cat /proc/sys/kernel/shmmax

Temporary resizing the shared memory limit

The following command allows you to resize the shared memory limit. This is a temporary solution (until next reboot). The size is in bytes.

sudo sysctl -w kernel.shmmax=64000000

Permanently resizing the shared memory limit

Edit the file /etc/sysctl.conf with the following command. The size is in bytes.

sudo gedit /etc/sysctl.conf

Modify or add the following line in the file:

kernel.shmmax=6400000