Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
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.
1. How can I calculate Memory usage that appears in the 'top' command in the top part, using the details shown in the processes table. When I try to sum up, using Excel, the processes memory percentage or VIRT, they do NOT add up to the amount shown in the top part for 'Mem'. I need to know which process is filling up Memory usage. Below is the whole dump:
Thanks for the reply but please read question carefully, I need to know how to calculate Mem usage (using the process details in the 'top' command output. ie, the table of processes). I did sort by M or using < to sort by VIRT or by RES, but that does not give me what I need, again, I need to know how is the 'Mem' entry in the top part of the 'top' command is calculated.
The summary info isn't calculated, it's read from /proc, just like all the other data in top. As such you have to assume it is correct - at lest as far as the kernel is concerned.
You can't expect the sum of the parts (that you can see) will equal the total used, but if you insist, subtract the cached and buffers numbers from used and try again.
Do some searching - there are hundreds of threads that explain why this math is necessary.
awk would be an easy way to mangle the numbers without having to use a spreadsheet.
Thanks for the replies. Actually the dump of 'top' command i pasted in my original message is when the system is healthy. Yet I would like to know how the some of parts would add up to the total, because the server keeps chalking approximately two weeks after a reboot and we can't tell which process is causing this. Our Linux guys are blaming the Java application saying that even killing Java processes doesn't clear up all the threads !!! The application guys saying after killing Java processes, memory should be cleared up.
If you know of threads that would explain those details, a link to the thread(s) would be great. Thanks
Anyway, I'd start by writing a simple daemon or cron job to keep an eye on the System Load and or/Mem figures and alert you as to when it 'chokes'.
Then either eyeball it or check the logs for msgs around that time, pref both.
Remember with Linux that killing a job/jobs doesn't automatically clear the mem, it simply enables the kernel to re-use that mem when it needs it for something else.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.