Swapping when memory is idle??

@lbutlr kremels at kreme.com
Thu Aug 20 18:40:35 UTC 2020


On 20 Aug 2020, at 01:53, Odhiambo Washington <odhiambo at gmail.com> wrote:
> I have a machine with 16GB RAM and not heavily used.
> I see from `top` some things that I do not understand well.
> Why would a system use swap when memory is idle?

Efficiency. Rather than reloading from static state disk libraries, you reload from swapped out RAM. This is faster as the swap maps right to the RAM and you are not reloading libraries and following depends.

An efficient system *may* use swap for any page that is not accessed for a certain period of time, trying to keep the system with as much memory as possible, or more usually a specific task will use a lot of memory, forcing pages to swap. This does not mean that memory was mixed out nor does it mean you need more RAM.

Once a page is in swap it will stay there until it is needed. So over the course of time, swap will tend to grow to some stable size, especially if you have a lot of rarely used services/libraries running.

If you have low uptime and high swap, that probably means something in your initial startup is using a lot of memory, but if the uptime is long, swap is probably going to grow.

And that is fine. You want you memory to be used.

I looks to me like your system is quite well used in terms of memory. There is 156M of free memory, but plenty of inactive and purgeable (laundry) which looks like a healthy system to me.

These are the important numbers, as long as the Free number is low, then high numbers in inac/laundry are what you want. If these are low and Free is also low, then your system is struggling.


-- 
I don't talk about problems, I disintegrate them.



More information about the freebsd-questions mailing list