2 ms·
I believe the symptomatic behavior of the two operating systems you are describing are the default choices around overcommit ratios and bytes and reserved memo
by LinuxBender 4y ago
I believe the symptomatic behavior of the two operating systems you are describing are the default choices around overcommit ratios and bytes and reserved memory and this only starts to become a problem when one is using more memory than what is installed.
Linux is by default very forgiving, to a fault. That fault being an application can ask for more memory than what is available and will use a simple formula to permit it. BSD is stricter by default on over-commit, thus keeping some people out of trouble at the risk of denying an application's request for more memory. This is really only a problem if the person is forking more processes and requesting more memory than what is installed and available.
Take a look at your committed memory and available memory:
grep Com /proc/meminfo; free -m
Assuming this is what you are running into on Linux this behavior can be disabled using
# vm.overcommit_ratio = 50 # is the default (mem+swap*1.5)
vm.overcommit_ratio = 0
in /etc/sysctl.conf or adjust as you see fit and then running sysctl -p or rebooting. There are other tunables that can prevent swapping or start swapping early depending on what behavior one prefers and how much memory is installed in the system in question. There are also tunables for reserving memory for root and for the kernel but I will avoid going down that rabbit hole without knowing your setup.