What Does the htop M_RESIDENT Column Filter Do?
Inside the setup options of the htop Linux command line
tool, enabling the M_RESIDENT column filter instructs
the program to display only the memory that is currently and actively
residing in the system’s physical RAM for each process. This filter
provides a more accurate representation of a process’s actual, immediate
footprint on your hardware by stripping away virtual memory allocations
that haven’t been mapped to physical memory or have been swapped out to
disk.
Understanding M_RESIDENT in htop
To understand what the M_RESIDENT filter achieves, it helps to look at how Linux manages memory. A standard process often allocates a large amount of Virtual Memory (VIRT), but it rarely uses all of it at the same time. The Resident Set Size (RES) represents the portion of that memory actually sitting in your RAM chips right now.
When you configure htop to filter or sort by M_RESIDENT,
you are shifting the focus away from theoretical memory allocations and
focusing strictly on real-time physical resource consumption.
Why Use the M_RESIDENT Filter?
System administrators and developers use this specific filter for several practical troubleshooting scenarios:
- Identifying Real Memory Leaks: A process might reserve a massive amount of virtual memory without causing performance issues. Filtering by resident memory helps you see if a program is actually bloating your physical RAM over time.
- Accurate Performance Profiling: If your system is running low on memory and starting to swap, the M_RESIDENT column instantly highlights which active processes are the true culprits driving the RAM shortage.
- Ignoring Idle Allocations: Many modern applications (like Java or Go runtimes) pre-allocate large pools of virtual memory upon startup. The M_RESIDENT filter prevents these applications from artificially dominating your memory usage lists when they aren’t actually using those resources yet.
How to Enable It in the htop Interface
To add or configure memory columns like M_RESIDENT in
htop, you can navigate through the setup menu by following
these steps:
- Open
htopin your terminal. - Press F2 (or S) to enter the Setup menu.
- Use the arrow keys to scroll down to Columns in the left-hand menu.
- Move to the Available Columns list on the right and look for memory-related metrics.
- Select the desired resident memory metric, press F5 to add it to your visible columns, and press F10 to save and exit.