out of memory?


 
Thread Tools Search this Thread
Operating Systems Linux out of memory?
# 1  
Old 07-29-2012
out of memory?

I had a situation where the server was basically unresponsive and apparently it was out of memory. I ran top and free commands and got the following outputs. I figured it was out of memory because there was no free swap left. But quite frankly I'm perplexed by this output, why does it appear that there's 18845 MB of free memory? I must be missing something.

Code:
# top

top - 10:40:03 up 13 days, 14 min, 21 users,  load average: 6.95, 9.27, 49.59
Tasks: 20984 total,   5 running, 20979 sleeping,   0 stopped,   0 zombie
Cpu(s): 10.3%us, 15.5%sy,  0.0%ni, 53.9%id, 19.9%wa,  0.0%hi,  0.4%si,  0.0%st
Mem:  24554800k total,  5376404k used, 19178396k free,      932k buffers
Swap:  2097144k total,  2097144k used,        0k free,   121164k cached

[snip]

# free -m
             total       used       free     shared    buffers     cached
Mem:         23979       5258      18720          0          0        123
-/+ buffers/cache:       5133      18845
Swap:         2047       2047          0

After some troubleshooting I found a stale NFS mount and there were thousands of hung command because of it (we ran some scripts every minute to get df usage - don't ask). Apparently they took up all the memory - after I killed them, it freed up half the swap space and the server was responsive again.

But I'm confused why it appeared I had almost 18GB of free memory. If someone could explain how to interpret the above numbers it would be great!
# 2  
Old 07-29-2012
Probably a high swappiness, if this is Linux, read from /proc/sys/vm/swappiness. Low value will favor dropping pages in cache, high value will write more to swap. Since you had lots of stale commands, the kernel figured they did not need to be in active memory.. But since you have so much free, I wonder why it swapped at all?
# 3  
Old 07-29-2012
Forgot to mention, this is RHEL 5.5 (64-bit). 24GB of physical memory.

Yes I agree the server was extremely slow because of constant swapping which I figured by 0 free swap space.

To be honest I have more experience with Solaris than linux, and I've seen similar issue on Solaris (no free swap memory so the server is extremely slow). However, in such situation I would see very low free memory (less than 1 GB). What puzzled me is why I had 18GB free and the server was acting as if it was out of memory. Unless I'm reading the output of these commands wrong?
# 4  
Old 07-29-2012
As a rule of thumb swap should be roughly equal to installed memory and at least twice the size of the largest process. It is no longer necessary to make swap twice memory (as was required with early unix). Linux uses swap continuously to optimise memory by swapping pages. If swap is too low, the Operating System will fail to function efficiently and may even stall.

With a rogue cron it is easy to exceed the kernel maximum number of files open by one user. If it is a root cron you are heading for a crash.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Solaris

[DOUBT] Memory high in idle process on Solaris 10 (Memory Utilization > 90%)

Hi Experts, Our servers running Solaris 10 with SAP Application. The memory utilization always >90%, but the process on SAP is too less even nothing. Why memory utilization on solaris always looks high? I have statement about memory on solaris, is this true: Memory in solaris is used for... (4 Replies)
Discussion started by: edydsuranta
4 Replies

2. Solaris

relationship or difference between entitled memory and locked memory

Hello solaris experts, Being new to solaris containers, from Linux, feeling difficulty in understanding certain concepts. Hope somebody can help me here. I understand that, & some questions .... Locked memory -- memory which will not be swapped out at any cause. is this for... (0 Replies)
Discussion started by: thegeek
0 Replies

3. UNIX for Advanced & Expert Users

Out of Memory error when free memory size is large

I was running a program and it stopped and showed "Out of Memory!". at that time, the RAM used by this process is around 4G and the free memory size of the machine is around 30G. Does anybody know what maybe the reason? this program is written with Perl. the OS of the machine is Solaris U8. And I... (1 Reply)
Discussion started by: lilili07
1 Replies

4. Solaris

restrcit physical memory with zone.max-locked-memory

Is it possible to restrict physical memory in solaris zone with zone.max-locked-memory just like we can do with rcapd ? I do not want to used rcapd (1 Reply)
Discussion started by: fugitive
1 Replies

5. Programming

How to deal with lots of data in memory in order not to run out of memory

Hi, I'm trying to learn how to manage memory when I have to deal with lots of data. Basically I'm indexing a huge file (5GB, but it can be bigger), by creating tables that holds offset <-> startOfSomeData information. Currently I'm mapping the whole file at once (yep!) but of course the... (1 Reply)
Discussion started by: emitrax
1 Replies

6. Solaris

How to find Total and Free Physical Memory and Logical Memory in SOLARIS 9

Hi, Im working on Solaris 9 on SPARC-32 bit running on an Ultra-80, and I have to find out the following:- 1. Total Physical Memory in the system(total RAM). 2. Available Physical Memory(i.e. RAM Usage) 3. Total (Logical) Memory in the system 4. Available (Logical) Memory. I know... (4 Replies)
Discussion started by: 0ktalmagik
4 Replies

7. AIX

ulimits max locked memory virtual memory

Hi, Would any one be so kind to explain me : are ulimits defined for each user seperately ? When ? Specialy what is the impact of : max locked memory and virtual memory on performance of applications for a user. Many thanks. PS : this is what I can see in MAN : ulimit ] ... (5 Replies)
Discussion started by: big123456
5 Replies

8. HP-UX

How can I get memory usage or anything that show memory used from sar file?

Refer from title: How can i get memory used or anything that can show memory from sar file example on solaris:- we can use sar with option to show memory used at time that sar crontab run. on HP-UX, it not has option to see memory used. But i think it may be have some parameter or some... (1 Reply)
Discussion started by: panithat
1 Replies

9. Programming

how to round up a memory address(memory alignment problem)

Hi, I try to marshal a unsigned int and a char * into a buffer, and then unmarshal them later to get them out. I need to put the char * in the front and unsigned int at the end of the buffer. However, my system always give me "BUS ERROR". I am using Sun Sparcs Sloris 2.10. My code to marshal... (6 Replies)
Discussion started by: nj302
6 Replies
Login or Register to Ask a Question