5

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.

1
  • Did you find a solution?
    – ewwhite
    Dec 11, 2012 at 21:06

3 Answers 3

3

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
1
  • 5
    Your hostname has been recently upvoted :)
    – pino42
    Nov 7, 2012 at 15:15
0

You can look at the cost map in the kernel documentation. In short, shared anonymous or /dev/zero maps count for their size just once, while private writable maps count once for each instance.

You can use pmap to look exactly at what a certain process is mapping and how. The output generated by pmap -d contains a footer line with the total aggregated size of private writable maps.

0

I've created a script based on @ewwhite 's answer to order all process in the system by their total committed memory. Script Can be found here https://gitlab.com/ramast/committed-memory-usage/-/blob/main/get_committed_memory.sh

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .