Doubt on the process memory - Linux

This is a discussion on Doubt on the process memory - Linux ; Hi All, I have a basic doubt about a process memory consumption. For a particular process when I do top -p (pid) I get the RSS size of the process, which is nothing but the memory consumption of the process. ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Doubt on the process memory

  1. Doubt on the process memory

    Hi All,
    I have a basic doubt about a process memory consumption.
    For a particular process when I do top -p (pid) I get the RSS size of
    the process, which is nothing but the memory consumption of the
    process.

    Now when I do cat /proc/pid/statm
    whose memory output never matches with the RSS size.What is the memory
    returned by the statm file ?

    Thanks in advance.
    Regards
    Arnab

  2. Re: Doubt on the process memory

    On Jul 8, 3:56*am, arnab wrote:

    > I have a basic doubt about a process memory consumption.
    > For a particular process when I do top -p (pid) I get the RSS size of
    > the process, which is nothing but the memory consumption of the
    > process.


    As the name suggests, RSS gets the *resident* set size.

    > Now when I do cat /proc/pid/statm
    > whose memory output never matches with the RSS size.What is the memory
    > returned by the statm file ?


    The 'statm' file contains:

    1) The total program size in pages.
    2) The resident size in pages.
    3) The number of shared/file-backed pages (if known)
    4) Number of code pages.
    5) Number of library pages (if known).
    6) Number of data pages.
    7) Number of dirty pages (if known)

    FWIW, they match exactly for me. For example, a process with an RSS of
    632KB (according to top) shows a resident size of 158 pages in statm.

    158 * 4096 = 647,168
    632 * 1024 = 647,168

    Dead on.

    DS

+ Reply to Thread