Increase shared memory on linux (shmmax)
Shared memory is often used in many applications on linux such as Oracle, Tibco, Webmethods. It’s also used for php extensions such as eaccelerator.
In this tutorial, I will show you how to increase the shared memory limit permanently.
The shared memory is stored in the following file: /proc/sys/kernel/shmmax
To check the size of your shmmax, write the following command:
you will see the number of maximum shared memory in bytes.
There are three ways to change the maximum limit. In the below examples, I will set the maximum shared memory to 64 MB (64 * 1024 * 1024 = 67108864)
First Method
This method is not permanent and will be reset once the server is rebooted:
Second Method
This method is permenant, the file sysctl.conf will be loaded during the boot process:
Third Method
This method is also permanent, but requires to edit the sysctl.conf directly:
and append the following:
Make sure to save the file using :w
If you use the second or third method, you will need to restart your server for the changes to take effects.
To restart your server, write the following command:
or:
Any questions? Leave us a comment below!