function::proc_mem_rss - Linux


Overview

proc_mem_rss calculates the Resident Set Size (RSS) memory usage of a process. RSS is the amount of physical memory currently occupied by the process and its children, excluding swapped or shared memory.

Syntax

proc_mem_rss <pid>
  • <pid>: The process ID to measure.

Options/Flags

None.

Examples

Get the RSS memory usage of a process with PID 1234:

proc_mem_rss 1234

Output:

1024 KB

Common Issues

  • PID not found: If the process pid does not exist, proc_mem_rss will exit with an error code.

Integration

proc_mem_rss can be used with other commands to monitor and profile memory usage, such as:

watch -n 1 proc_mem_rss 1234

This command continuously prints the RSS memory usage of process 1234 every second.

Related Commands

  • ps: Lists running processes and their memory usage.
  • top: Shows a real-time view of system resource usage.
  • vmstat: Prints statistics about memory usage, including RSS.