Skip to content
Linux & VPS

Fix Linux Killing Your Server (OOM Killer / Out of Memory)

Out of memory: Killed processoom-killerserver randomly stops
8 min read Updated 12 June 2026 ESAGAMES Team

If your server process vanishes with no crash log, Linux probably killed it to save the system from running out of RAM — the "OOM killer". Here's how to confirm and prevent it, including the container-specific memory limits people forget about.

Confirm it was the OOM killer

Check the kernel log for the tell-tale message:

dmesg | grep -i 'killed process'
journalctl -k | grep -i oom

A line like Out of memory: Killed process 1234 (java) confirms the kernel killed your server to free RAM.

Why it happens

The total RAM requested by everything on the box exceeded what's available. Common causes: a server allocated more than the machine has (e.g. -Xmx too high), too many servers on one box, or a memory leak.

CauseHow to spot itFix
One server allocated too much-Xmx near/over total RAMLower -Xmx, leave OS headroom
Too many servers on one boxCombined limits exceed RAMMove one off, or upgrade the plan
A memory leakRAM climbs steadily until the killFind and update the leaking app
Container memory limit hitKilled well below host RAMRaise the container/cgroup memory limit
No swap on a tight boxKills on brief spikesAdd a small swap file as a buffer

How to stop it

  • Lower your allocation — leave 1–2 GB for the OS; never give a server all system RAM.
  • Add swap — a few GB of swap absorbs spikes (slower, but prevents kills).
  • Run fewer services per box, or move to a plan with more RAM.
  • Find leaks — if usage only ever climbs, profile the app/plugins.
# add 4G of swap
fallocate -l 4G /swapfile && chmod 600 /swapfile
mkswap /swapfile && swapon /swapfile
It kills the "worst" process

The OOM killer targets the process using the most memory — often your game server, even if a different process caused the spike. Fixing total RAM pressure is the real solution.

Confirm with dmesg, then leave headroom for the OS, add swap, and run within the RAM you actually have.

Container-specific memory limits

If your server runs in Docker or under a panel like Pterodactyl, a cgroup memory limit set on the container can trigger its own OOM kill independent of the host's total RAM — even if the host itself has plenty free. Check the container's configured memory limit, not just system-wide RAM — docker inspect shows a container's memory limit, and systemctl show shows a systemd service's MemoryMax.

How to prevent OOM kills for good

  • Size -Xmx (or the panel's RAM limit) comfortably below the container/host's actual memory, never equal to it.
  • Watch memory trend over days, not just a snapshot — a slow leak looks fine until it isn't.
  • Set vm.overcommit_memory and swappiness sensibly rather than leaving kernel defaults untouched on a memory-constrained VPS.

Related errors

If the process fails to even start rather than being killed later, see fixing "cannot allocate memory" (fork failed). For Minecraft specifically running out of heap, see fixing Minecraft "out of memory" (Java heap space). To check usage generally, see how to check CPU, RAM and disk usage on Linux.

Right-sized RAM, no surprises

Our plans give your server the RAM it needs with room to spare — no OOM kills, protected in Frankfurt.

See hosting
FAQ

Frequently asked questions

Why does my game server randomly stop with no crash?

Linux's OOM killer probably terminated it to free RAM. Check dmesg for "Killed process". It means the machine ran out of memory and the kernel killed the biggest process — often your server.

How do I stop the OOM killer killing my server?

Don't over-allocate RAM (leave 1–2 GB for the OS), add some swap to absorb spikes, run fewer services per machine, or move to a plan with more memory. Fix any memory leaks.

Does adding swap fix out-of-memory?

Swap absorbs short spikes and prevents kills, but it's much slower than RAM. It's a safety net, not a substitute for having enough actual memory for your workload.

Can Docker or a panel kill my server for memory even if the host has RAM free?

Yes — a per-container cgroup memory limit (set by Docker, Pterodactyl, or systemd) enforces its own ceiling independent of total host RAM. Check the container/service memory limit specifically, not just system-wide usage.

What's the difference between the OOM killer and a normal crash?

A normal crash usually leaves an error/crash log written by the application itself. An OOM kill is abrupt — the kernel sends SIGKILL with no chance for the app to log anything, which is why it looks like the process just vanished.

How much RAM headroom should I leave for the OS?

A rough rule of thumb is 1-2 GB free for the OS and background processes on a small VPS, more on a busier box running a panel, database, or multiple services alongside the game server.

Knowledge base

Related articles

Skip the troubleshooting

Managed, protected hosting in Frankfurt — we handle the Linux, the network and the DDoS so you don't have to.

Payments Secure checkout with cards, banking apps and digital wallets.

Choose the payment flow that fits your stack and region without leaving the platform.

Pay by Zen Visa Mastercard Paysafecard PaysafeCash Skrill Trustly Bancontact UnionPay iDeal WebMoney