How can I measure the actual memory usage of an application or process?

后端 未结 30 3132
心在旅途
心在旅途 2020-11-22 03:01

This question is covered here in great detail.

How do you measure the memory usage of an application or process in Linux?

From the blog articl

30条回答
  •  臣服心动
    2020-11-22 03:49

    Beside the solutions listed in the answers, you can use the Linux command "top". It provides a dynamic real-time view of the running system, and it gives the CPU and memory usage for the whole system, along with for every program, in percentage:

    top
    

    to filter by a program PID:

    top -p 
    

    To filter by a program name:

    top | grep 
    

    "top" provides also some fields such as:

    VIRT -- Virtual Image (kb): The total amount of virtual memory used by the task

    RES -- Resident size (kb): The non-swapped physical memory a task has used ; RES = CODE + DATA.

    DATA -- Data+Stack size (kb): The amount of physical memory devoted to other than executable code, also known as the 'data resident set' size or DRS.

    SHR -- Shared Mem size (kb): The amount of shared memory used by a task. It simply reflects memory that could be potentially shared with other processes.

    Reference here.

提交回复
热议问题