Sample Header Ad - 728x90

Why is memory (rss) from ps command different than memory seen in top command?

1 vote
2 answers
6871 views
Here on MacOS Catalina, when checking the memory usage of a process I see that the ps command shows a RSS value which is different from the memory usage shown in top:
$> ps e -o command,vsize,rss,%mem|grep "myapplication"|head -n 1
myapplication  4594896  51364  0.3
**RSS -> 51364**
top
PID    COMMAND       %CPU TIME    #TH             #WQ  #PORT MEM    
48106  myapplication 115.7        09:06.12 69/1   1    101   37M+
**MEM -> 37M** Why this difference? **UPDATE:** Another example with IntelliJ process:
top -pid 357
PID  COMMAND      %CPU TIME     #TH   #WQ  #POR MEM    PURG CMPRS  PGRP PPID STATE    BOOSTS        %CPU_ME %CPU_OTHRS UID       FAULTS    COW   MSGSENT  MSGRECV  SYSBSD
357  idea         2.6  03:16:46 112   1    925  4906M  0B   1583M  357  1    sleeping  0      0.00000 0.00000    281451937 28337096  54627 8404446+ 2733245+ 156093159+
Top shows **4906M**
ps aux
USER               PID  %CPU %MEM        VSZ    RSS   TT  STAT STARTED      TIME COMMAND

xxxxxxx            357   3.6 14.5 180050484 2430728   ??  S     1:44PM 196:48.70 /Applications/IntelliJ IDEA.app/Contents/MacOS/idea -psn_0_73746
ps shows RSS **2430728** (KB)
Asked by codependent (123 rep)
Mar 30, 2020, 12:01 PM
Last activity: Jul 26, 2025, 04:06 PM