π ~1 min read
Table of contents
Symptom & Impact
Memory pressure triggers OOM kills, causing service crashes and instability.
Environment & Reproduction
Observed after swapoff changes on memory-constrained hosts.
free -h
Root Cause Analysis
No swap headroom exists for transient memory spikes and reclaim behavior.
Quick Triage
Check swap status and recent OOM events.
swapon --show && dmesg | grep -i 'Out of memory'
Step-by-Step Diagnosis
Review vm settings and per-service memory peaks.
sysctl vm.swappiness vm.overcommit_memory && sudo journalctl -k --since -2h

Solution – Primary Fix
Create and enable swapfile with secure permissions.
Still having issues? Our Managed IT Services team can diagnose and resolve this for you. Get in touch for a free consultation.
sudo fallocate -l 4G /swapfile && sudo chmod 600 /swapfile && sudo mkswap /swapfile && sudo swapon /swapfile

Solution – Alternative Approaches
Scale memory allocation or tune service limits to reduce peak usage.
Verification & Acceptance Criteria
Swap is active and OOM kill events no longer appear under expected load.
Rollback Plan
Disable and remove swapfile if policy forbids swap usage.
Prevention & Hardening
Establish memory alert thresholds and capacity planning baselines.
Related Errors & Cross-Refs
Related to cgroup memory limit hits and abrupt process terminations.
Related tutorial: View the step-by-step tutorial for Ubuntu 24.04 LTS.
View all Ubuntu 24.04 LTS tutorials on the Tutorials Hub β
Browse all common problems & solutions on the Tutorials Hub.
References & Further Reading
Ubuntu swap management and Linux OOM behavior references.
Need Expert Help?
If you cannot resolve this yourself, our team offers hands-on Server Management, Managed IT Services, and flexible Support Plans. Contact us today β we respond within one business day.