Calculating private and shared memory for processes
Rahul Gore (Nokia)
rahul.gore at nokia.com
Mon Feb 13 18:56:43 EST 2023
Hello,
Just wanted to follow up on this question. Please let me know if I'm missing anything basic that I need to do to solve this problem.
Regards,
Rahul
From: Rahul Gore (Nokia)
Sent: Friday, February 10, 2023 2:43 PM
To: kernelnewbies at kernelnewbies.org
Subject: Calculating private and shared memory for processes
Hi,
I'm trying to find private and shared memory usage of each process in Linux. One answer on Stack Overflow suggested using 'smem' utility (it reads /proc/<pid>/smap). However, the sum of all PSS values in 'smem' output is not equal to Used value of the 'free' utility (it reads /proc/meminfo).
CLI output:
$ sudo smem -t | tail -n 5
2950301 1002 gfstandalone_1_0 --test hw/ 0 1427244 1435899 1453060
2950368 1002 gfstandalone_1_1 --test hw/ 0 1432172 1440818 1457588
3012185 rgore java -classpath /home/rgore 0 2159256 2159348 2163268
-------------------------------------------------------------------------------
537 23 702168 24722224 26865451 62093364
$ free -w
total used free shared buffers cache available
Mem: 65625036 26415500 511020 351372 1541640 37156876 38119868
Swap: 2097148 726148 1371000
So, I doubt the accuracy of the values in /proc/<pid>/smap. Is there a more reliable alternative?
Regards,
Rahul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20230213/33d63dde/attachment.html>
More information about the Kernelnewbies
mailing list