Read more

find out which processes using swap

Claus-Theodor Riegg
January 15, 2016Software engineer at makandra GmbH

Wondering which processes are placed in your swap you can use this bash oneliner:

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

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

You will see the swap usage of each process sorted by the highes amount of swap usage.

Please don't forget that swap usage of a process isn't an indicator for high memory usage of this process but for the frequency of access or activity of it. The kernel tries to avoid swapping pages which were recently accessed.

Also you should notice that the fact that memory pages allocated by a process are placed in swap does not mean that the pages are not in the main memory. Memory pages can be stored in the swap and in the main memory at the same time. This allows the system to release memory very quickly.

Posted by Claus-Theodor Riegg to makandra dev (2016-01-15 13:40)