After running the command top on Raspbian, I get the following result:

KiB Mem :   948956 total,   249788 free,   549408 used,   149760 buff/cache    
KiB Swap:   102396 total,     3836 free,    98560 used.   309492 avail Mem 

Why is my device using so much swap memory while plenty of standard memory can be used? Also, how can I identify which processes use the swap?


2 Answers 2


Most likely because at some point previous to this swap was needed. Moving data into swap is a priority when free memory is low, but moving it out is not a priority when free memory is available. The justification for this is pretty sound if you think about it for a bit.

Stuff that gets swapped out in the first place is stuff that isn't being accessed much, but which cannot be released. For example, if you have a server running that isn't very active, its data might be eligible.

This implies whatever process (A) caused the need for swapping is not the process (B) who's data has been swapped. When process A ends and its memory is released, this has no effect on whats in swap. The stuff in swap stays there until it is both needed and there is enough free memory to hold.

Hence if, before process B becomes active, some other process suddenly needs some RAM, it will be available without the need to swap. If instead the seldom accessed stuff had been swapped back in as soon as RAM were available, the swapping would have to be done all over again.

This is a heuristic which matches general usage patterns. Stuff that isn't active tends to stay that way. You can tune how swapping is done, but unless you have very unusual needs there is not much point.


It will depend on how you are using your pi, basicaly what software you are using and how resource intensive that software is. It also could depend on how many programs you have open at a time. If you are using, say, VLC and Chromium and GIMP at the same time, you are going to be using a lot of RAM and maybe some swap space. Compiling a program from source will to that too. This generaly isn't an issue (correct me if I am wrong) other that it will slow down your access time to the SD card and will make a lot of read/writes on the relativly fragile SD card.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.