5

I'm trying to diagnose a memory leak in a process, and looking for a tool to graph its memory usage over time.

Is there any tool on Linux that supports diagramming in a form similar to Windows PerfMon?

I tried using IBM virtual assistant, but it works only on 32-bit, while I have 64-bit platform.

Thanks.

Dennis Williamson
  • 60,515
  • 14
  • 113
  • 148
SyRenity
  • 3,159
  • 11
  • 55
  • 79

2 Answers2

3

Quick hack:

for((i=0;;++i)) { echo $i $(grep VmSize /proc/$(pidof firefox-bin)/status | grep -o '[0-9]*'); sleep 1 || break; } > data
^C
graph -T X data

The same could be done for things other than "VmSize".

user47713
  • 123
  • 4
Vi.
  • 821
  • 11
  • 19
  • 2
    Useless use of `cat`. – Dennis Williamson Mar 16 '10 at 21:43
  • This seems most interesting approach. 1) What I need installed on CentOS for graph to work? 2) Why cat is useless? – SyRenity Mar 17 '10 at 12:18
  • Actually, from what I read so far VMSize seems to show only part of the picture. So far the most useful tool for me was ps_mem from here (http://www.pixelbeat.org/scripts/ps_mem.py). The only question is how to plot the resulting graph - I just can't find this "graph" tool on Linux. – SyRenity Mar 17 '10 at 21:23
  • Fixed "useless use of `cat`" – Vi. Mar 18 '10 at 18:37
  • `graph` is from `plotutils` package on Debian. For CentOS it should be something like http://dag.wieers.com/rpm/packages/plotutils/ You can also request `-T svg` instead of `-T X` if you want to insert the plot somewhere. – Vi. Mar 18 '10 at 18:39
0

We use Cacti, which is the next gen MRTG, to graph system memory usage.

Walter
  • 1,047
  • 7
  • 14
  • Can it monitor a single process? – SyRenity Mar 17 '10 at 12:17
  • To monitor a single process, see the documentation on SNMP for adding a custom command to the SNMP values. The use something like ps with grep and/or awk to find the memory values for your process and output it as a value. Then in Cacti, graph this value as a gauge. – Walter Mar 17 '10 at 15:43