What Is the Difference Between VIRT and RES in htop?

When monitoring system performance in Linux using htop, understanding memory consumption is crucial for troubleshooting resource bottlenecks. Two of the most commonly misunderstood columns are VIRT (Virtual Memory) and RES (Resident Memory). While both metrics reflect a process’s memory footprint, they represent fundamentally different things: VIRT measures the total memory a process thinks it has access to, including allocated but unused space and swapped data, whereas RES measures the actual, physical RAM the process is currently consuming. Distinguishing between the two helps system administrators accurately identify whether a process is genuinely draining system resources or simply reserving address space.

Understanding VIRT (Virtual Memory)

The VIRT column represents the total virtual memory address space allocated to a process. It is a theoretical figure that includes everything the process has mapped into its environment, regardless of whether it is actively occupying physical RAM.

VIRT is composed of:

Because Linux uses an “optimistic” memory allocation strategy called overcommitting, processes can request massive amounts of virtual memory that they may never actually use. Consequently, a high VIRT value is rarely a cause for concern on its own.

Understanding RES (Resident Memory)

The RES column stands for Resident Set Size. This metric represents the actual, physical RAM that a process is actively consuming at that exact moment. If you want to know how much of your hardware’s RAM a specific application is draining, RES is the metric you should look at.

RES is composed of:

Unlike VIRT, RES cannot be overcommitted. It corresponds directly to physical hardware limitations. If the total RES of all running processes approaches the limit of your physical RAM, the system will begin swapping data to disk or trigger the Out-Of-Memory (OOM) killer to terminate processes.

Key Differences at a Glance

The relationship between these two columns can be best understood by comparing how they handle allocation, hardware impact, and shared resources:

Which Metric Should You Monitor?

When debugging a slow system or investigating a suspected memory leak, RES is almost always the more important metric to watch. A high RES value means the process is actively taking up physical space that other applications might need.

On the other hand, a massive VIRT value alongside a tiny RES value usually just indicates that a program (such as a Java application or a database) has pre-allocated a large address space for future efficiency, which is standard behavior and safe to ignore.