April 30, 2011

Finding the memory usage of a process

I recently needed to figure out how to determine the memory usage of a process so I could log it over time. I used the following command to accomplish this.

mike@shiner $ ps -p 7557 -o pid,vsz,rss
  PID      VSZ    RSS
 7557  1983664 298536

You'll need to replace '7557' with the process id you're investigating. The meaning of 'VSZ' and 'RSS' is copy and pasted here from the man page:

     rss        resident set size
     vsz        virtual size in Kbytes (alias vsize)

'RSS' represents the amount of memory resident in RAM. The rest of the memory is held in swap space or the filesystem. 'VSZ' is the amount of virtual memory allocated to the process.

No comments:

Post a Comment