I have 8Gb usable memory and 10Gb swap space available
My memory usage is 90-95% used while only +/- 1gb swap space is used.
Do I misunderstand the purpose of swap space or is there some issue on my side?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
If you'd run the
top command, you'd see something in line with this:
KiB Mem: 32868436 total, 32695528 used, 172908 free, 20 buffers KiB Swap: 0 total, 0 used, 0 free. 31194124 cached Mem
In this particular case, we have 32 gigs of RAM, of which just 172 MiB is shown as "free".
We do not have swap at all in our case.
Yet, to calculate the "real" free memory, add "cached Mem" to "free" and you would see that almost all of the memory is free.
The trick is that "cached Mem" is basically disk cache - Linux would use most of available free memory just for that to speed up disk operations. Do not worry - should a necessity for extra memory arise, Linux can instantly reduce the disk cache and use that for whatever purposes are needed. You only need to start worrying once both "free" and "cached Mem" are very small - that would mean you probably need a RAM upgrade to keep things running smoothly.
As to swap, I would agree with the previous replies that you don't want to use it in vain in cases where you have plenty of RAM. And 8 gigs are plenty for a desktop, if you are not using some heavy graphics processing software or such.