To swap or not to swap, that is the question.

camtaf

Active Member
Joined
May 14, 2023
Messages
345
Reaction score
218
Credits
2,307
Just because I don't need or use swap personally, doesn't mean it's not useful in certain circumstances, if you regularly run a heavy load, if you compile software, if you open dozens of web browser tabs, if you create/manipulate video, hibernation on a laptop, etc, then it will be useful - but for an average desktop jockey such as myself, definitely not needed. :D

P.S If you check your ram usage, you will always find it caching data, for quick access.
 


OP
dos2unix

dos2unix

Well-Known Member
Joined
May 3, 2019
Messages
2,111
Reaction score
1,725
Credits
15,271
It seems everyone thinks swap is "ONLY" for additional memory. They need to go back and read the OP.
Yes, that's what it is mainly for. But it is also used in laptop hibernation. This is where the current state of your computer is stored. But it sometimes used for "in-place" upgrades as a place to store things off the file system. It is also used as a holding place while some RAM applications "defrag"
themselves.

For example, ( this doesn't happen anymore with newer versions of Java ) 1.7 and older wanted your application
to run in contiguous memory. So lets say you had 4 GB of RAM, and your Java app took up 2GB. No problem right?
I have 3 GB of RAM free. But if it wasn't in contiguous memory space ( all one single RAM block ) it wouldn't load
because even though I had enough free RAM, it wasn't all together in a single block. It that case, it just used swap
as contiguous memory.

Also there are still a few old programs that want to load certain metadata in swap, they won't even let you run
the program unless you have a swap partition. They don't care if you have 120GB of RAM free. They won't run
without swap. Some RAM heavy applications ( Oracle databases comes to mind ) have there crash logs written
to swap by default, in case your system crashes due to running out of memory.

It mostly isn't used by anything anymore, unless you have a laptop that's sleeping, or you run out of memory.
But that's certainly not all it's used for.
 

KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
10,670
Reaction score
9,163
Credits
88,594
It seems everyone thinks swap is "ONLY" for additional memory.

coughs

Not me! LOL I more or less understand what swap is used for.

I even have swap enabled, albeit with a swapfile and not a partition. If there's a performance hit, it's trivial on modern hardware. SSD speeds are quite high these days.
 

dcbrown73

Well-Known Member
Joined
Jul 14, 2021
Messages
392
Reaction score
367
Credits
3,519
I always keep a swap partition even if the likelihood of using it is almost nil. ;)

There are reasons why you would want it. Not just for extra memory.

1699829191047.png
 

f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
6,407
Reaction score
4,861
Credits
47,079
That always reminds me of the "double your ram" scams in the 90s...
Why does zram remind you have double your ram scams and I don't know what the double your ram scams are since I didn't know much about computers back then?
 

Members online


Top