Here is my htop output:

For example, I'm confused by this ruby script:

How much physical memory is it using? 3+1+8+51+51? 51? 51+51?
Here is my htop output:

For example, I'm confused by this ruby script:

How much physical memory is it using? 3+1+8+51+51? 51? 51+51?
Hide user threads (shift + H) and close the process tree view (F5), then you can sort out the process of your interest by PID and read the RES column (sort by MEM% by pressing shift + M, or F3 to search in cmd line)
Memory is a hard thing, you cannot calculate used physical memory by just running ps/htop/top. Memory can be shared between processes.
I recommend you to check usage with this script:
ps_mem -p pid. When doing ps_mem -p pid1,pid2 I get 600+600=1200MiB. Wouldn't the shared portion be shared by both processes, and shouldn't then the result for ps_mem -p pid1,pid2 should be 600+300=900MiB? When I kill one of the two, 300MiB are freed according to free. When killing the other process, another 300MiB are freed.
– Evgeniy Berezovsky
Mar 12 '20 at 05:08
Take a look at the Column RES and SHR.
RES - SHR = Total estimated memory usage by the process.
REScolumn is the one you want to look at. – David Schwartz Jun 21 '13 at 09:0251s? Does it consume 102 megabytes? Or only 51 megabytes? In the outer process RES contains the inner process RES , why the3,1,8are all fewer than51? – Lai Yu-Hsuan Jun 21 '13 at 09:03forka process, its pages will be copied and occupies some new memory space. How can the parent and child process share all 5992 kb memory? Am I wrong? – Lai Yu-Hsuan Jun 21 '13 at 09:39