0

I have RHEL 5.8. After every one month or so, server will go into unresponsive state or rejects ssh connections. Somehow, if I can get into server, "free" will show me that 98% of memory is utilized. But when I check processes, I can't see any process which is consuming high memory. I am not sure if it is memory leak and if it is, how to detect/find it.

Below is its current status. It shows 20% of memory is utilized, though I can't find yet, what all processes are using that 20%. Eventually in a month or so, it will climb up.

[root@server2 ~]# watch "ps --sort -rss -eo pid,pmem,rss,vsz,comm | head -16" 
Every 2.0s: ps --sort -rss -eo pid,pmem,rss,vsz,comm | head -16                                                                                                      Thu Feb 21 21:46:14 2019
PID %MEM   RSS    VSZ COMMAND
3812  5.4 443788 443800 ssp_x86Linux_bo
4873  1.1 98028 303884 media_server
5232  0.3 28584 177324 oacore
5561  0.1 16156 100944 hpsensor
5443  0.1 15336 254948 yum-updatesd
5572  0.1 11988 137308 opcmona
3896  0.1 11716 255824 bmserver
3372  0.1 10884 160908 snmpd
5535  0.1 10760  79132 opcmsga
5199  0.1 10388 142188 ovcd
5525  0.1  9580 125692 opcacta
5207  0.1  9568 116444 ovbbccb
3764  0.1  9536 465776 dlgsysmonitorse
5514  0.1  9520 122424 opcmsgi
5465  0.0  8024  43744 ovconfd
[root@server2 ~]# free -m
         total       used       free     shared    buffers     cached
Mem:          7983       1651       6331          0        223        714
-/+ buffers/cache:        712       7270Swap:         9983          0       9983
[root@server2 ~]# free -m | awk 'NR==2{printf "Memory Usage: %s/%sMB (%.2f%%)\n", $3,$2,$3*100/$2 }'
Memory Usage: 1651/7983MB (20.68%)
[root@server2 ~]#

Thanks

user3183426
  • 21
  • 1
  • 4
  • https://www.linuxatemyram.com/ you have ~712M used, the sum of your RSS is ~700M. – Zoredache Feb 21 '19 at 23:12
  • https://serverfault.com/questions/449296/why-is-linux-reporting-free-memory-strangely https://serverfault.com/questions/67759/how-to-understand-the-memory-usage-and-load-average-in-linux-server?rq=1 – Zoredache Feb 21 '19 at 23:17
  • 3
    We can't help you without seeing some information from the server while it's having problems. Seeing it operating normally isn't going to help us find the problem. – David Schwartz Feb 21 '19 at 23:57
  • 3
    RHEL 5 is past end of life. Even if you are able to gather information while the server is having a problem, it might not be possible to solve it. – Michael Hampton Feb 22 '19 at 02:32

1 Answers1

2

Free memory the least useful memory your system can have. It is no better than a stick of RAM sitting on a shelf. If you are thinking, "I want my RAM free now so I can use it later", get that out of your head. You can both use the RAM now and use it later. RAM does not need to be free now to be used later. There is no trade-off involved here. Keeping RAM free has a cost, using RAM has none.

Even memory that holds just random junk is more useful than free memory. Why? Because free memory has to be made unfree to provide any benefit. Memory holding random junk doesn't require this extra step.

So modern OSes like Linux make every effort to use RAM for some purpose, any purpose, rather than encountering the worst case scenario of having free RAM.

For example, say a program executes and then finishes. The OS could make the memory that held the program free. But why should it? That's extra effort. It's effort that has to be undone to use the memory. And if the OS keeps the program in memory and the program runs again, it won't have to be read in from disk. So the OS keeps the memory in use, even though no process is using it.

The short answer to your question is it's random junk that needed to be in memory before. It is being kept in memory rather than making the memory free because that's more efficient, particularly if the data might be needed again, but even if not.

Whatever performance issue you're having cannot be analyzed by looking at normal memory usage while your system is functioning normally.

David Schwartz
  • 31,215
  • 2
  • 53
  • 82