I ran the command a.out like this:

$ /usr/bin/time -f"%M" ./a.out

a.out also uses the function getrusage() and prints:


where the first ru is the struct. When I run it, it gives me:


What is the difference between maximum resident set size as reported by /usr/bin/time %M and getrusage?

  • Can you please include the source for a.out?
    – slm
    Apr 24, 2014 at 1:48

1 Answer 1


According to the getrusage() man page:

long   ru_maxrss;        /* maximum resident set size */

While the man page for /usr/bin/time states the macro %M is as follows:

%M     Maximum resident set size of the process during its lifetime, in Kbytes.
  • My getrusage() call is the last call in the program right before the printing of ru.ru_maxrss Apr 24, 2014 at 1:52
  • I don't see any difference b/w the 2, only when they're called.
    – slm
    Apr 24, 2014 at 2:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .