Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Are there any tools to detect memory leaks of running programs in Linux? I know of Valgrind, but it's mostly used to debug for memory leaks and not simply to detect memory leaks.

share|improve this question
If you just want to find out which process is leaking, you could run atop and collect stats about per process memory usage over time. – AnonymousLurker Jul 13 '13 at 18:51
up vote 0 down vote accepted

I'm not sure, but something I have observed on my Minecraft server is the ever going memory cache its taking. To counter against the cache taking all the memory I run these commands in cron every day....


sudo sync
sudo echo 3 | sudo tee /proc/sys/vm/drop_caches

echo -e "\033[36mMemory before\033[0m"
free -m
sudo sync
sudo echo 3 | sudo tee /proc/sys/vm/drop_caches
echo -e "\033[32mMemory after :)\033[0m"
free -m
share|improve this answer
The cache taking up all the memory is a good thing. RAM is still much faster than disk, and cache always gets discarded automatically whenever a process allocates memory for itself. – grawity Aug 16 '11 at 10:00
True. Unfortunately there are some programs, like the Minecraft server, that love to take up some memory, and even use a little bit of my swap space (*_*). That's why once a day is great for any long uptime computers. I'm not so sure what Rayne wants to do. There are already tools that report memory use and debug tools to detect leaks. If it's those slow memory hoggers, then I prescribe this simple bash script or submitting a bug report to stop the leaks. – Koodough Aug 23 '11 at 5:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .