Re: "ps -o %mem" and free memory in Linux
On Tue, 2020-09-29 at 10:24 +0700, Victor Sudakov wrote:
> Dear Colleagues,
>
> Could you please clarify for me how the following is possible. `ps` shows
> that the php-fpm workers have occupied 62% of physical memory, while
> `free` shows that only 1.3Gi (which is 17% of total RAM) is used:
>
> $ ps axww -o cmd,%mem |awk '/php-fpm/{sum+=$NF}END{print sum}'
> 62.1
> $ free -h
> total used free shared buff/cache available
> Mem: 7.5Gi 1.3Gi 4.4Gi 113Mi 1.8Gi
> 5.8Gi
> Swap: 0B 0B 0B
> $
Perhaps because the php-fpm workers were forked from the same parent
and so a lot of theie 'physical' RAM is actually the same RAM as each
other, because it's not been modified?
--
Tixy
Reply to: