A process that vanishes under memory pressure may have been killed by the kernel, a cgroup, a service manager, or an administrator. Do not infer the cause from exit status alone. Preserve the kernel message and the relevant memory counters first.
Search this boot’s kernel log
journalctl -k -b \
-g 'Out of memory|Killed process|oom-kill' \
--no-pagerIf the journal is unavailable, try:
dmesg --ctime | grep -E 'Out of memory|Killed process|oom-kill'Record the timestamp, process name, PID, cgroup path, and memory figures. A global OOM event and a cgroup limit breach can both kill a process, but their remedies differ. Adding machine memory will not fix a deliberately small service limit.
Linux can reclaim file-backed cache under pressure, while anonymous memory and unreclaimable kernel allocations behave differently. A single free snapshot rarely explains the sequence that led to an OOM decision.1
Read cgroup v2 counters
For the current shell:
rel=$(awk -F: '$1 == "0" { print $3 }' /proc/self/cgroup)
dir="/sys/fs/cgroup$rel"
for name in memory.current memory.max memory.events memory.pressure; do
printf '\n%s\n' "$name"
cat "$dir/$name"
donememory.current is current usage. memory.max is the hard limit, or max when no hard limit is set. memory.events contains counters such as high, max, oom, and oom_kill; increases are stronger evidence than a current-usage snapshot taken after the victim has exited.2
For a systemd service, first obtain its cgroup path:
systemctl show example.service \
-p ControlGroup -p MemoryCurrent -p MemoryMaxReplace example.service with the affected unit. Read the corresponding files below /sys/fs/cgroup if you need the raw event counters.
Treat OOM scores as context
For a running process:
pid=12345
cat "/proc/$pid/oom_score"
cat "/proc/$pid/oom_score_adj"oom_score is the kernel’s current badness score for that process. oom_score_adj influences the score. Both can change as conditions change, so values collected after an incident are context, not proof of which process was killed.3
Build a useful incident record
Keep the kernel message, cgroup counters, unit configuration, workload timestamp, and any application memory metrics together. Then decide whether the root cause was an undersized limit, unbounded concurrency, a leak, a traffic spike, or pressure elsewhere in the same cgroup.
[!CAUTION] Do not reproduce an OOM event on a shared machine. Changing
memory.max,oom_score_adj, or service limits can kill unrelated work or remove an intentional safety boundary.