Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

How to fix “vm.max_map_count is too low” | Rocky/ CentOS

While installing MongoDB on a server we were greeted with a warning message "vm.max_map_count is too low"

By default, Linux will restrict the maximum number of memory maps per process to 65530 on Rocky Linux 8.

While this may be enough for most use cases, some might actually need more memory maps. Once this limit is exhausted, you may encounter an error like "cannot allocate memory", even though you may have plenty of free RAM available.

To fix this temporarily and without having to reboot your server, issue the following command at the terminal:

echo 9999999 > /proc/sys/vm/max_map_count

To set this permanently, you will have to add the following line into the /etc/sysctl.conf file:

vm.max_map_count=9999999

Now all you have to do is reboot and you should be set.

You should monitor the memory maps and increase the value if it exceeds half of the limit you have set. To monitor the memory maps, issue the following command:

cat /proc/IRIS_PID/maps | wc -l