What is the RSS unit in psutil.Process.get_memory_info?

When I use ps -o pid,rss -p 1 , I see the following:

 PID RSS 1 784 

But when I request rss with psutil , I get a different value:

 >>> p = psutil.Process(1) >>> print p.get_memory_info().rss 802816 

Is it possible that psutil using a different block? I cannot find any related information in the documentation .

+7
source share
2 answers

The ps output is in kilobytes. The RSS (resident set size) of psutil is in bytes.

 >>> 802816 / 784 1024 

From man ps :

 rss RSS resident set size, the non-swapped physical memory that a task has used (in kiloBytes). (alias rssize, rsz). 
+10
source
 import os import psutil process = psutil.Process(os.getpid()) print(process.memory_info().rss) # in bytes 
0
source

Source: https://habr.com/ru/post/950801/


All Articles