Solved

How to determine which program is using most memory on my unix server

Posted on 2011-03-15
16
631 Views
Last Modified: 2012-08-14
Hi,
Attached is a screenshot of the top command from my unix CentOS server. It has 2GB memory and the top command is showing all the 2 GB as being used. I have be following questions:
1. Is it normal for the server to show all the memory as being used?
2. How can I find out which process is using the most memory? In the %MEM column I don't see the total usage to be more than 20%
3. If all the memory is being used then do I need to explicitly run the garbage collector to free up the memory?

Thanks.
top-command-screenshot.JPG
0
Comment
Question by:orazen12
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
  • 4
16 Comments
 
LVL 92

Accepted Solution

by:
objects earned 400 total points
ID: 35144515
1. no
2. http://www.cyberciti.biz/faq/linux-check-memory-usage/
3. no, garbage collection is really independent of os memory usage
0
 
LVL 92

Expert Comment

by:objects
ID: 35144520
looks like you need to configure some swap space
0
 

Author Comment

by:orazen12
ID: 35144676
Thank for your reply Objects.
But as in the attachment, the top command shows does not show the memory usage to be more than 20%. Then why is it showing as all the memory being used? What I am trying to say is that if there's some other problem then even after configuring swap space it'll occupy that space too.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 92

Expert Comment

by:objects
ID: 35144697
thats not all the processes. I suspect the os itself would be using the bulk of the memory
0
 

Author Comment

by:orazen12
ID: 35144715
I agree. But my system has 2GB RAM. 20% of that would be about 400 MB. Would the OS be using 1600 MB? It is running mySQL, TOMCAT, Crontab and has Java installed. Nothing major. Earlier I had 1 GB and since when I ran my program it started showing as all the memory as being used up, I upgraded it to 2GB. Now it is showing as that also being used up completely. If I was not to run my Java program a lot of memory would be free. So I am not sure if so much memory is being occupied by the OS.
0
 
LVL 92

Expert Comment

by:objects
ID: 35144765
> What I am trying to say is that if there's some other problem then even after configuring swap space it'll occupy that space too.

why do you say that?
without any swap the os is going to have to hold *everything* in physical memory.
0
 

Author Comment

by:orazen12
ID: 35144911
I just tried to create a swap but I can not since it's a virtual server I've taken and creating a swap is not allowed in this case. Also, all the 2 GB I'm using is virtual since it's a virtual server.

Please suggest what should I do now.

Thanks.
0
 
LVL 92

Expert Comment

by:objects
ID: 35144968
if its a virtual server then you should check if all those memory figures are actually for the vm, and not for the host
0
 

Author Comment

by:orazen12
ID: 35145098
I am sorry I didn't get you. When I do a vmstat, get the same amount in used as in top.
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 100 total points
ID: 35145161
Please execute the following in a directory in which you have write permissions (pref the temp dir) and attached the file free.log here:


free -m | tee free.log

Open in new window

0
 
LVL 86

Expert Comment

by:CEHJ
ID: 35145872
If you're running in a virtual server, you need to determine from the hosting how they've got it configured
0
 

Author Comment

by:orazen12
ID: 35145990
Here's the result of the command:

                                           total       used       free     shared    buffers     cached
Mem:                               2048       1481        566          0          0          0
-/+ buffers/cache:          1481        566
Swap:                                           0          0          0
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 35146009
Looks fine
0
 

Author Comment

by:orazen12
ID: 35146027
I think the memory figures are for the VM only. When I had 1 GB it was showing 1 GB there and then I upgraded my server to 2 GB and now it is showing 2 GB. So I don't think the figures are of the host. I think it is of the VM only.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 35146140
Yes, that's entirely expected
0
 

Author Closing Comment

by:orazen12
ID: 35272723
Thanks.
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question