Linux memory

How to troubleshoot memory issues in Linux

Outages due to out of memory are common issues with Linux systems, mainly in web hosting industry. People trying to run their personal blog or website in 512MB VPS servers often face these issues. But its a difficult job to find the exact service or web application which is causing OOM ( http://en.wikipedia.org/wiki/Out_of_memory ). Below are few commands that will help you trace the memory issues.

Check OOM

To make sure that outage was due to OOM. Check for OOM errors in logs.

ps is a great helper

List of running processes sorted on memory usage

To get more details on memory usage of individual process, try following command

Replace httpd with the process name whose memory usage details you want.

Alternative :

pmap to check process memory mapping

Following command will give more details on memory usage of process

Scripts with pretty output

There are script written to provide details of process memory usage in friendly format.

A detailed article on memory management in Linux will be posted later. Hope the above commands will help you trace memory hogging process.