1

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.

1
  • 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. Jul 13, 2013 at 18:51

1 Answer 1

0

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....

Command

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

free_memory.sh

#!/bin/bash
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
2
  • 3
    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. Aug 16, 2011 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, 2011 at 5:01

You must log in to answer this question.

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