E
E
Evgeny Sementsov2015-05-12 12:27:45
linux
Evgeny Sementsov, 2015-05-12 12:27:45

How to find out where RAM goes in Linux?

I can't figure out where the memory is being lost.
The fact is that the sum of the processes in ps shows one thing, and the available memory (counted as inactive + free + cached) is completely different.
The difference is 10 gigabytes. There is a suspicion that something is leaking, but the memory is not released, even after the process ends.
Memory collection checked with a simple bash code

#!/bin/sh 

d=`date +%F_%H` 
f=/root/vm_utilize/$d.log 

ps axu | awk '{print $11 " " $5}' | grep -v ' 0$' | grep -v VSZ >> $f 

sum=0 
for i in  `ps axu | awk '{print $5}' | grep -v VSZ`; do 
  sum=$(($sum + $i)) 
done 
echo $sum >> $f

UPD:
slabtop helped see:
OBJS ACTIVE USE OBJ SIZE SLABS OBJ/SLAB CACHE SIZE NAME
21155820 21155820 100% 0.19K 1057791 20 4231164K dentry
That's a lot!
Found a description of the problem here - serverfault.com/questions/561350/unusually-high-de... Finally
updated libcurl.
The question is closed.
Described here:
forum.openvz.org/index.php?t=msg&goto=48093&
There is a solution:
sync && echo 2 >/proc/sys/vm/drop_caches
Additionally discussed here:
All memory gradually goes under Cached
linsovet.org.ua /content/linux-flush-system-caches

Answer the question

In order to leave comments, you need to log in

4 answer(s)
E
Evgeny Sementsov, 2015-05-12
@relsy

To dispel doubts.
Here is an example (free or cat /proc/meminfo):
MemTotal: 32,880,924 kB
MemFree: 12,564,540 kB
Buffers: 366,052 kB
Cached: 4,967,724 kB
Inactive: 2,853,512 kB
Total free 20,385,776
Sum by processes at the same time - 8 839 420 kB (counted through ps - the code was written above). Somewhere else ~ 4 GB of memory has gone.
What do you think - what is the flaw here?
==============================
UPD
Question closed.
Described here:
forum.openvz.org/index.php?t=msg&goto=48093&
There is a solution:
sync && echo 2 >/proc/sys/vm/drop_caches
Additional discussion here:
All memory gradually goes under Cached
linsovet.org.ua/content/linux-flush-system-caches

S
Sergey Fadeev, 2015-05-12
@fadeev2010

Why do top and free show that the memory is busy when they are not?
www.linuxatemyram.ru

S
Sergey, 2015-05-12
@edinorog

the funniest thing about these tips is that you really can’t check where the leak is, and where is the garbage that the system, you see, decided to transfer to the RAM;). they also often write about android that it will free up memory as needed .. the need comes and your phone decides to reboot ... because you see, it doesn’t even have enough memory for system tasks.

V
Vlad Zhivotnev, 2015-05-12
@inkvizitor68sl

www.linuxatemyram.ru
welinux.ru/post/2388
Well, you probably thought wrong.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question