DigitalOcean Droplet Out of Memory (OOM Killer)
Quick answer
On 512 MB to 2 GB Droplets the Linux OOM killer ends your biggest process (MySQL, Node, PHP). Confirm with dmesg, add a swap file, trim memory use, or resize the Droplet.
Most likely fix: Confirm it is the OOM killer
How to fix it
Try these in order — the most common fix is first.
1. Confirm it is the OOM killer
- Run sudo dmesg -T | grep -i -E "out of memory|killed process"
- Check usage with free -h and top (sort by memory with Shift+M)
Did this fix it?2. Add a swap file
- sudo fallocate -l 2G /swapfile
- sudo chmod 600 /swapfile && sudo mkswap /swapfile && sudo swapon /swapfile
- Add "/swapfile none swap sw 0 0" to /etc/fstab so it survives reboot
- Swap on SSD is slow, so treat it as a safety net not a fix
Did this fix it?3. Reduce memory use
- Lower worker counts (PHP-FPM pm.max_children, Gunicorn workers) and database buffers
- For Node set NODE_OPTIONS=--max-old-space-size to a value that fits
- Build locally or in CI instead of on the Droplet
Did this fix it?4. Resize
- Power off the Droplet, open Resize, choose a plan with more RAM (a CPU and RAM only resize can be reversed; resizing the disk is permanent)
- Check the new monthly price before confirming
Did this fix it?
Symptoms
Services die randomly, the site goes down, logs say "Out of memory: Killed process", builds fail with "Killed" or heap out of memory.
Why it happens
- Small Droplet with no swap (Droplets do not ship with swap by default)
- MySQL/PostgreSQL or PHP-FPM tuned for much larger servers
- Node build or app exceeds heap
- Memory leak in your app
- Traffic spike spawns too many workers
This guide also covers
- digitalocean droplet out of memory
- droplet killed process oom
- digitalocean droplet add swap
- droplet mysql keeps crashing
Still not working?
If DigitalOcean keeps failing, you're not alone. See every DigitalOcean problem users report or the alternatives people switch to.
Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.
Talk to usOther DigitalOcean errors
- DigitalOcean Droplet SSH Permission Denied (publickey)
- DigitalOcean Droplet SSH Connection Refused or Timed Out
- DigitalOcean Droplet 502 Bad Gateway (Nginx)
- DigitalOcean App Platform Build Failed
- DigitalOcean App Platform Deploy Failed or 502 After Deploy
- DigitalOcean Account Locked or Verification Required
- DigitalOcean Unexpected Bill: Charged for Deleted or Powered-Off Droplets
- DigitalOcean Droplet Locked Out: Reset Root Password and Recovery Console