How can I find out the amount of memory COMMITED by a process on Linux?

To prevent the OOM killer running, I have set vm.overcommit_memory = 2 and vm.overcommit_ratio = 100 . I would like to know how much memory is committed by a given process, which is contributed to the commit count.

It is not the resident working set, since the resident working set does not include the amount swapped out. It is not the virtual size either, since the virtual size includes mmap()ed files, which do not contribute to the commit limit.


Solution 1:

Run pmap -x PID for the process's ID to show memory allocation.

[root@ObamaBiden ~]# pmap -x 8106
8106:   /opt/dbcfs/dbcfsrun 10.51.64.76 4483 /opt/dbcfs/dbcfs.cfg 9584:1 -ssl
Address           Kbytes     RSS   Dirty Mode   Mapping
0000000000266000     120      96       0 r-x--  ld-2.12.so
0000000000284000       4       4       4 r-x--  ld-2.12.so
0000000000285000       4       4       4 rwx--  ld-2.12.so
0000000000288000    1584     388       0 r-x--  libc-2.12.so
0000000000414000       8       8       8 r-x--  libc-2.12.so
0000000000416000       4       4       4 rwx--  libc-2.12.so
0000000000417000      12       8       8 rwx--    [ anon ]
0000000008048000     912     624       0 r-x--  dbcfsrun
000000000812c000      56      44      36 rwx--  dbcfsrun
000000000813a000     152      60      60 rwx--    [ anon ]
0000000008a51000     280     132     132 rwx--    [ anon ]
00000000f678c000   16008    5396    5396 rwx--    [ anon ]
00000000f7739000       4       4       4 rwx--    [ anon ]
00000000f773a000       4       4       0 r-x--    [ anon ]
00000000ffd8a000      84      32      32 rwx--    [ stack ]
----------------  ------  ------  ------
total kB           19236    6808    5688