Why memory usage is more than physical RAM in Linux?

前端 未结 1 1001
遇见更好的自我
遇见更好的自我 2021-01-18 08:17

I am working on an embedded system with 512MB of RAM and enough swap memory to support the application. From the kernel, I have restricted the RAM size from the kernel cmd a

相关标签:
1条回答
  • 2021-01-18 08:48

    VSZ is virtual memory size which is used by the process. It's normal that it's higher than the size of your physical memory because this is one of the main ideas of this. You should rather look at Resident size (RSS) which is the actual physical memory used by the process.

    Look at this example:

    I have an nginx process running:

     ps -o rss,vsz,cmd ax | grep -i nginx | head -n1
      956  31248 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
    
    rss - 956 kB
    vsz - 31248 kB
    

    So, it means this process is using 956kB of physical memory, and 31MB of virtual memory.

    Disabling swap (swapoff -a), like you did, doesn't disable using virtual memory.

    Read about virtual memory here: Virtual memory

    0 讨论(0)
提交回复
热议问题