Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a dedicated server where I've installed apache2, as well as rails-passenger. Although i have 2GBs of RAM and most times about 1,5GB is free, there are some random times where I loose ssh and generic connectivity because oom-killer is killing processes.

I suppose there is a memory leak but I cannot find out where it comes from. oom-killer kills apache2, mysql, passenger and whatever.

Yesterday, I did a cat syslog | grep -c oom-killer and got 57 occurences!

It seems that something seriously destroys the memory. Once I reboot, everything comes back to normal. I suspect that it can be related to passenger, but I'm still trying to figure it out.

Can you think of another cause, or do you have anything to suggest that will make the leak identification procedure easier? I was even thinking of writing a bash script, to be run with cron for like every 5 minutes.

share|improve this question
    
Yeah, until you run a script pinpointing which processes are growing, when, and how fast, it's not an answerable question. –  SilverbackNet Jan 10 '11 at 7:04
add comment

1 Answer

The Linux kernel by default overcommit memory so that sometimes a program will successfully allocate memory not available and the OOM will kick in and kill a random process instead. Disabling this would perhaps allow you do perhaps identify what application steals memory. E.g. if a application is suddenly allocating a huge chunk of memory it will fail (and hopefully return a error message). Other applications may fail allocating memory as well so you should watch out for a false positive.

echo 2 > /proc/sys/vm/overcommit_memory

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.