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 Answer
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
-
3The 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.– KoodoughAug 23, 2011 at 5:01