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.



Quick hack:

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

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

  • 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 (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 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

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

  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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