Linux – is the VPS running out of memory

linuxmemoryvps

I have a Linux Virtual Private Server with 1GB memory, but I keep getting errors like:

fork failed: Cannot allocate memory

However, I don't think I'm short on memory. If I run free:

root@server44:~# free -m
             total       used       free     shared    buffers     cached
Mem:          1024        133        890          0          0          0
-/+ buffers/cache:        133        890
Swap:            0          0          0
root@server44:~# man swapon
man: fork failed: Cannot allocate memory

I have 890 MB free, but fork is failing. Any idea why? Is the server my server is running on running out of memory? My host is FsckVPS running HyperVM.

Best Answer

What virtualization technology are you using? With OpenVZ/Virtuozo at least, the 'free' command does not show your actual memory available. Often it shows much larger than the amount that is actually allocated to your VPS slice.

In addition, there are several different 'memory' limits that limit different types of memory (in OpenVZ terms they are kmemsize, lockedpages, privvmpages, shmpages, vmguarpages, oomguarpages, etc).

If you are using OpenVZ, check /proc/user_beancounters to see what limit you are hitting, check in the 'failcnt' column.