sudo journalctl -k | grep -i 'killed process', find what used the memory with ps aux --sort=-%mem | head, then add swap, lower the memory settings of the biggest program, or move to a plan with more RAM.
Before you start
- Typical signs: a database, game server or website stops without an error of its own, or a terminal command just prints
Killed. - Restart the killed service first (
sudo systemctl restart mariadb, for example) so your site is back while you look for the cause. - Commands use
sudo. As root, leave it out.
Step 1: Confirm the OOM killer did it
sudo dmesg -T | grep -i 'killed process' shows the same since the last boot.
For a systemd service, its own log says so as well:
Step 2: See what uses the memory
free -h shows total RAM, what is used and whether swap exists. The ps list shows the biggest processes first; the RSS column is the memory in use, in kilobytes. Watch it live with htop (press Shift+M to sort by memory).
Cause 1: One program is set to use too much
Databases, Java apps and game servers take the memory their settings allow. A setting larger than your RAM guarantees an OOM kill. Fix: lower the setting so all your programs fit, with room left for the system:
A program whose memory keeps growing until it is killed has a memory leak. Update it, or restart it on a schedule until the fix is out.
Cause 2: There is no swap
Swap is disk space the kernel uses as overflow when RAM is full. It is much slower than RAM, but it can turn a sudden kill into a short slowdown. Check:free -h shows Swap: 0B.
Fix: add a swap file of 1 to 2 GB. See add swap space on Linux. Swap doesn’t fix a server that is permanently short of RAM.
Cause 3: Too much traffic or too many workers
Each web worker, PHP process or player uses memory. A traffic spike, a crawler or a small attack multiplies them. Fix: cap the number of workers (Cause 1 table), add caching, and block abusive traffic with Fail2ban or CrowdSec.Cause 4: A service or container limit
Memory cgroup out of memory means a limit you or a tool set was reached: MemoryMax= in a systemd unit, or --memory / mem_limit in Docker.
Check:
Protect your most important service
You can make the kernel prefer other processes. Open an override for the service:sudo systemctl restart mariadb. The range is -1000 (never kill) to 1000 (kill first). Use -1000 sparingly: if nothing else can be killed, the server may freeze instead.
How to check it worked
Over the next days, this should print nothing new:free -h should show free or available memory left at your busiest time.
Frequently asked questions
Why did the OOM killer pick my database and not something else?
The kernel scores processes mainly by how much memory they use, so the biggest one usually goes first. Lower its settings or protect it withOOMScoreAdjust.
Can I turn the OOM killer off?
Not safely. Without it, a server that runs out of memory hangs. Fix the memory use instead.When should I upgrade instead?
When your programs, at sensible settings, still use more RAM than you have at normal load. Comparefree -h at peak times with your plan’s RAM.
Related guides
VPS and dedicated server guides
Every guide in this section.
Check memory usage
Read free, top and htop.
Add swap space
Overflow space for RAM spikes.
Limit CPU and memory
Cap one service’s resources.
High load on a Linux server
When the server is slow, not killed.
Checked against the official Linux kernel memory management documentation and the systemd systemd.exec manual (
OOMScoreAdjust=) on 4 November 2026; an OOM kill was reproduced in a 64 MB memory cgroup on Ubuntu 24.04 LTS and the kernel log lines were checked. The systemd override and the service log lines were not tested, because systemd doesn’t run in our test container.Need Extra Help?
If you encounter any issues, our support team is ready to assist:- Live Chat: Quick assistance via our website.
- Support Ticket: Open a Ticket
- Discord: Join our Community
- Email: support@freakhosting.com
Last Updated: November 2026