Reputation: 12973
I have a small program, much like grep
or cat
that allocates memory when it is running. I would like to know how much memory is allocated at maximum throughout its run. How could I do that?
Upvotes: 2
Views: 485
Reputation: 2252
Usually if it's memory related I'll check if valgrind has it first:
http://valgrind.org/docs/manual/ms-manual.html
doing something like:
valgrind --tool=massif <program-name>
ms_print massif.<date>
Towards the top of the of the ms_print output should be a graph that will give you the info you desire.
Upvotes: 1
Reputation: 50104
Use /usr/bin/time
for that purpose. Example:
/usr/bin/time -f '%M kB' command args...
Upvotes: 3