LLI Wiki — My Digital Knowledge Base

Troubleshoot memory issues on Linux

Find OOM events, identify the memory-consuming process, read its OOM score and inventory the installed memory.

Commands to troubleshoot memory problems on a Linux server: finding out-of-memory (OOM) kills, identifying the process that consumes memory, and checking the installed hardware. Based on the UpCloud tutorial on troubleshooting Linux memory issues.

Search for "out of memory" events

sudo grep -i -r 'out of memory' /var/log/

Identify a process

ps aux | grep <process name>

Example output:

mysql     5872  0.0  5.0 623912 51236 ?        Ssl  Jul16   2:42 /usr/sbin/mysqld

The PID is the second field of the line (5872 in this example).

Check the OOM score of a process

cat /proc/<PID>/oom_score

The higher the value, the more likely the kernel is to terminate this process when memory runs out.

Overall memory view

free -m
vmstat
cat /proc/meminfo

Inspect the memory hardware

These commands require root privileges:

Command Information
sudo dmidecode -t 16 Maximum supported capacity and number of memory slots
sudo dmidecode -t 17 Installed memory modules (size, speed, etc.)
sudo dmidecode -t memory Complete memory information
dmidecode -t 4 Processor
sudo dmidecode --type 2 | grep Product Motherboard model
Mastodon LLIMastodon SocialFosstodon