A way to determine a process's “real” memory usage, i.e. private dirty RSS?

后端 未结 10 1682
我在风中等你
我在风中等你 2020-11-29 15:15

Tools like \'ps\' and \'top\' report various kinds of memory usages, such as the VM size and the Resident Set Size. However, none of those are the \"real\" memory usage:

10条回答
  •  独厮守ぢ
    2020-11-29 16:12

    Use the mincore(2) system call. Quoting the man page:

    DESCRIPTION
         The mincore() system call determines whether each of the pages in the
         region beginning at addr and continuing for len bytes is resident.  The
         status is returned in the vec array, one character per page.  Each
         character is either 0 if the page is not resident, or a combination of
         the following flags (defined in ):
    

提交回复
热议问题