Linux memory: Difference between revisions

From DWIKI
Line 13: Line 13:
*[https://web.archive.org/web/20120520221529/http://emilics.com/blog/article/mconsumption.html Memory Consumption in Linux]
*[https://web.archive.org/web/20120520221529/http://emilics.com/blog/article/mconsumption.html Memory Consumption in Linux]
*[https://www.studytonight.com/operating-system/difference-between-paging-and-swapping Difference between Paging and Swapping]
*[https://www.studytonight.com/operating-system/difference-between-paging-and-swapping Difference between Paging and Swapping]
*[https://www.baeldung.com/linux/swap-space-use The Use of Swap Space in Modern Linux Systems]


= Documentation =
= Documentation =

Revision as of 10:34, 20 April 2022


Links

Documentation

man 5 proc

see /proc/meminfo

total

Is MemTotal in /proc/meminfo

Total usable ram (i.e. physical ram minus a few reserved bits and the kernel binary code)

used

total - free - buffers - cache

unused

MemFree

RSS

Resident Set Size

RSS and VSZ inLinux memory management

"memory is allocated to that process and is in RAM. It does not include memory that is swapped out. It does include memory from shared libraries as long as the pages from those libraries are actually in memory. It does include all stack and heap memory."

VSZ / VmSize

Virtual Memory Size It includes all memory that the process can access, including memory that is swapped out, memory that is allocated, but not used, and memory that is from shared libraries.

FAQ

What is using all my memory?

smem -r -s swap| head -n3


What is using all my swap?

for file in /proc/*/status ; do awk '/VmSwap|Name/{printf $2 " " $3}END{ print ""}' $file; done | sort -k 2 -n -r | less

or to just list top 3

for file in /proc/*/status ; do awk '/VmSwap|Name/{printf $2 " " $3}END{ print ""}' $file; done | sort -k 2 -n -r | head -n 3

Clear buffer/cache

sync; echo 3 > /proc/sys/vm/drop_caches