How to measure memory usage?

How to measure memory usage?

am 22.01.2006 01:10:32 von kj

What's the best way to determine the most memory a program uses
during its execution?

Thanks!

kj

--
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.

Re: How to measure memory usage?

am 22.01.2006 02:32:42 von krsyoung

Depending on how accurate of data you need, usually top or ps will do
the trick. If you want more data than just eye balling top, run ps in
a shell script to have it poll the process every couple of
seconds/minutes too see how much memory it is using. With a command of
ps -o vsz,rss you can get a good idea of these values.

Also, if you wanted in another shell you could run watch -n 5 "ps -o
vsz,rss " which will run the command every 5 seconds.

Hope this helps!
Chris