OOM (Out Of Memory) error happens when a server run out of Memory. When a server runs out of memory, processes get randomly killed to free up memory. This will result in the service that gets killed stop functioning.
How to avoid OOM Error
Here are a few things you can do to avoid server running out of memory.
- Reduce memory usage by your application if possible. Poorly coded applications can use a lot of memory, and cause memory leaks.
- Upgrade Memory (RAM). Adding more RAM to the server helps.
- Add Virtual Memory. You can add swap, this will use your disk as memory, it is slower than RAM, but help to avoid OOM when the server runs out of memory.
To see if your server had OOM error, run
Debian/Ubuntu
grep -i oom /var/log/syslog*
RHEL/AlmaLinux
grep -i oom /var/log/messages* cat /var/log/messages* | grep 'Out of memory'
Back to Errors