[SOLVED] How to find total memory used by a process?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3292 stack 20 0 2010648 82940 8708 S 5.6 1.0 12:51.49 ceilometer-agen
Now the million dollar question is - what does "total memory" mean? Virtual memory (VIRT)? Physical memory (RES)? Does it include shared memory (SHR)? You decide.
EDIT I didn't read your question thoroughly. You want to sum up the memory usage of all chrome processes, which top is not really the right tool for.
Last edited by berndbausch; 11-12-2018 at 05:38 AM.
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3292 stack 20 0 2010648 82940 8708 S 5.6 1.0 12:51.49 ceilometer-agen
Now the million dollar question is - what does "total memory" mean? Virtual memory (VIRT)? Physical memory (RES)? Does it include shared memory (SHR)? You decide.
EDIT I didn't read your question thoroughly. You want to sum up the memory usage of all chrome processes, which top is not really the right tool for.
I have always heard that ps was not the good tool to know how much memory use a process.
And I guess this is why :
Man ps :
Quote:
The SIZE and RSS fields don't count some parts of a process including the page tables, kernel
stack, struct thread_info, and struct task_struct. This is usually at least 20 KiB of memory
that is always resident. SIZE is the virtual size of the process (code+data+stack).
I would say no, that is not true. I suggest you to read this: www.linuxatemyram.com just to understand better how memory is handled.
Furthermore the used ram may change during the script you use, so probably that (the result) is simply outdated immediately.
I think I finally figured it out on how to get an almost precise total memory of a group of processes.
Good for you - I'd forgotten about smem to be honest.
pss is provided by the kernel (these days) to apportion shared library usage to users, rather than charging everybody who has a reference for the full amount of every library. There are a couple of utilities that attempt to report it - be happy with the one you found.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.