Jeff
Jeff

Reputation: 135

Max physical memory use of a process

If I want to estimate the max physical memory use of a process, can I simply iteratively invoke "top" command for that process and pick up the maximum value of "RES" field?

Thanks

Upvotes: 2

Views: 81

Answers (2)

ErikR
ErikR

Reputation: 52057

The GNU version of time allows you to display the max RSS during its lifetime using the %M format.

Note that you probably have to invoke it as /usr/bin/time -f %M command... so you don't run the shell's builtin time command.

On OSX, use /usr/bin/time -l command....

Upvotes: 1

David Schwartz
David Schwartz

Reputation: 182865

Yes, but understand that you're measuring properties of the system as much as properties of the process. For example on a system under memory pressure, resident set sizes will be smaller even if the process is going the same thing.

Upvotes: 1

Related Questions