Resident set size (RSS) is the portion of a process’s memory that is currently held in physical RAM, measured in bytes or pages. In memory management, a core area of operating systems, RSS separates what a program has merely reserved in its virtual address space from what actually occupies page frames at a given moment.
RSS is reported by tools such as ps, top and the Linux /proc filesystem, and it is the closest everyday equivalent of the working set reported by Windows. It is useful but easily misread, because it counts shared pages in full for every process that maps them.
How resident set size is measured
The kernel computes RSS by counting the pages mapped in the process page table that are present in physical memory. Pages that were reserved but never touched, pages swapped out to disk and file pages that have been evicted from the page cache are not part of the resident set.
On Linux, RSS is split into three components: anonymous memory such as the heap and stack, file-backed memory such as executable code and memory-mapped files, and shared memory segments. Demand paging means that a freshly started program has a small RSS that grows as it touches new pages and triggers page faults.
The table below compares RSS with the other memory figures that tools commonly display.
| Metric | What it counts | Typical use |
|---|---|---|
| Virtual size (VSZ) | All mapped virtual address space | Detecting address-space growth |
| Resident set size (RSS) | Pages currently in physical RAM | Quick view of RAM occupancy |
| Proportional set size (PSS) | Private pages plus a fair share of shared pages | Accurate per-process accounting |
| Unique set size (USS) | Pages used only by this process | Memory freed if the process exits |
| Windows working set | Pages resident for the process | Task Manager and performance counters |
What resident set size includes and excludes
Understanding what RSS leaves out is as important as knowing what it counts. Several memory types are invisible to RSS even though they consume system resources on behalf of the process.
| Memory type | Counted in RSS | Comment |
|---|---|---|
| Touched heap and stack pages | Yes | Private anonymous memory |
| Loaded code of executables and libraries | Yes | Shared with other processes using the same file |
| Reserved but untouched allocations | No | No page frame assigned yet |
| Pages moved to swap | No | Return to RSS after a major page fault |
| Kernel memory for the process | No | Page tables and socket buffers are kernel overhead |
| Compressed pages in zram or zswap | No | Stored in a compressed pool |
Copy-on-write adds further nuance. After a fork(), parent and child processes share the same physical pages, so each reports the full size in its RSS, yet the system has spent memory only once until one of them writes to a page.
Resident set size and related memory concepts
RSS is a snapshot of current residency, whereas the working set describes the pages a process has used within a recent time window. When the combined working sets of all processes exceed available RAM, the kernel must evict pages that will soon be needed again, which leads to thrashing.
The page replacement algorithm decides which pages leave the resident set under memory pressure. Linux reclaims file-backed pages first, because they can be dropped and reread, and swaps anonymous pages only when necessary. On the other hand, the out-of-memory killer uses a score that is heavily based on RSS plus swap usage when it must terminate a process.
Using resident set size in practice
RSS is the default first indicator for memory troubleshooting because it is cheap to read and available on every platform. Its trend over time is often more informative than any single value: a steady, unbounded rise under constant load is a strong hint of a memory leak.
The following decision table matches typical questions to the most suitable metric.
| Question | Best metric | Reason |
|---|---|---|
| Is this service leaking memory? | RSS trend over hours | Steady growth reveals retained allocations |
| How much RAM do all workers really use? | Sum of PSS | Shared pages are counted once |
| How much RAM will stopping it free? | USS | Only private pages are released |
| Will the container hit its limit? | cgroup memory usage | Includes page cache charged to the group |
| Is the address space fragmented? | VSZ and memory maps | RSS ignores unmapped reservations |
- On Linux, read VmRSS in /proc/PID/status for the current value and VmHWM for the peak.
- Use
smaps_rollupto obtain PSS and the anonymous versus file-backed split. - On Windows, compare working set and private bytes to distinguish residency from commitment.
Limitations and common misreadings
The most frequent mistake is adding RSS across processes. Shared libraries, shared memory and copy-on-write pages are counted in every process that maps them, so the sum can far exceed installed RAM. Multiprocess applications such as browsers and preforking web servers are especially prone to this double counting.
A low RSS is also not proof of a small footprint. A process whose pages were swapped out or compressed shows a reduced RSS while still holding the same data, and it may slow down sharply when those pages fault back in. Conversely, huge pages can raise RSS in 2 MiB steps, making small allocations appear larger than they are.
In plain words
Resident set size tells you how much real memory a program is using right now. A program can reserve far more space than it ever touches. Only the parts it actually uses sit in RAM.
Picture a library card that lets you borrow fifty books. RSS counts only the books on your desk today. Some books are shared with a roommate, so both of you count them. That is why adding everyone’s numbers can mislead.
A real-world example
An operations engineer monitors a Linux server running a web application with eight worker processes. The monitoring dashboard sums their RSS and reports 9.6 GB, although the server has only 8 GB of RAM and is not swapping. The engineer reads the smaps_rollup files and finds that the total PSS is about 3.1 GB, because the workers share the same code and preloaded data through copy-on-write.
One worker, however, shows RSS growing by about 40 MB per hour while the others stay flat. A heap profiler traces the growth to an unbounded cache. After the cache receives a size limit, RSS stabilizes at around 380 MB, and the dashboard is changed to plot PSS for capacity planning and RSS trends for leak detection.