Does the top command under Linux display memory or heap memory?

topThe command provides a real-time view of the system running status under Linux, including process information, CPU usage, memory usage, etc. Regarding memory, topthe command does not display "heap memory", but the memory usage of the entire system.

In topthe output of the command, you will see memory statistics similar to the following:

KiB Mem :  16268640 total,  11707480 free,   2990444 used,   1583708 buff/cache
KiB Swap:  8388604 total,   8345492 free,     43112 used.  12576076 avail Mem 

The key indicators here are explained below:

  • total: Total physical memory size.
  • free: Currently unused physical memory size.
  • used: The size of physical memory used.
  • buff/cache: Memory size used for buffer and cache.
  • avail Mem: Memory that can be used to launch new applications without swapping.

**The "heap" is an area of ​​memory that is dynamically allocated by a process while it is running. **In topthe command, you will not see statistics about the heap directly. If you want to know the heap usage of a specific process, you may want to use a tool like pmapor .valgrind

In short, topwhat is shown is the overall memory usage of the system, not just the heap memory.

Guess you like

Origin blog.csdn.net/qq_21950671/article/details/133274906