Answer the question
In order to leave comments, you need to log in
How to understand what memory is spent on in linux?
There is a process that according to top consumes 13.5% of RAM. However, according to free, memory is used - 67.2%. How to understand where the rest of the memory went?
I tried to investigate the problem using tools such as /proc/meminfo, /proc/PID/status, free, top, smem.
What we have: I count the memory occupied by processes according to data from /proc/meminfo according to the formula MemTotal-Free-Cached-Buffers-Slab, it turns out the same value that shows free in the used line, somewhere 67.2% in relation to MemTotal , while this value increases with time, the memory "flows", but I can't figure out where exactly it flows: in some process or in the kernel.
If you examine the processes, then top shows me 3 columns: VIRT, RSS and SHR, the memory of each process consists of RSS and SHR, but since SHR is shared memory used by several processes simultaneously, these columns cannot be summarized. Then, instead of top, I used smem, which calculates such a value as PSS - proportional memory, which can already be summed up, smem also knows how to calculate the sum of all processes as a percentage, and so it showed me - 16.2%, while free says that 67.2% are employed, the question is where did the remaining 51% go?
Answer the question
In order to leave comments, you need to log in
do not thank:
ps axo rss,comm,pid | awk '{ proc_list[$2] += $1; } END { for (proc in proc_list) { printf("%d\t%s\n", proc_list[proc],proc); }}' | sort -n | tail -n 10 | sort -rn | awk '{$1/=1024;printf "%.0fMB\t",$1}{print $2}'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question