Amy is a user on You can follow them or interact with them if you have an account anywhere in the fediverse. If you don't, you can sign up here.
Amy @PinkCathodeCat

Because I couldn't find this article on the defence of swap:

· Web · 3 · 5

@ryliejamesthomas The issue I see with this perspective is that it assumes that the memory allocated by an application is necessarily good, when we've seen lots of memory bloat and leaks in applications in the past. Additionally, needless disk swapping worsens system responsiveness due to the latency of the operation.

This is especially an issue for games (Doom 3 for example never unloaded anything, would hitch significantly after playing for too long)

@ryliejamesthomas @PinkCathodeCat I used to disable swap but found that Linux's OOM handling at some point changed to thrash the disk instead of killing the offending process. I use swap now but I still consider it more like emergency space than anything

@HihiDanni @ryliejamesthomas I have 4 GB swap, but things rarely hit it (8 GB RAM, play games sometimes).

I do remember the horrible days of memory leaks, especially the Firefox ones.

@HihiDanni @PinkCathodeCat @ryliejamesthomas

I think you're assuming that the OS can free up unused memory. It can't. If a program allocates and then loses ("leaks") some RAM, there's no way the OS can tell the difference between that and RAM that it still needs but doesn't use often. It has to assume it's still used until told otherwise.

Swap is actually good for leaky programs because the leaked memory is unused and so tends to get swapped to disk and left there. You waste swap, not RAM.

@suetanvil @PinkCathodeCat @ryliejamesthomas I am 100% aware that the OS can't deallocate RAM used by apps. What I'm saying is that the existence of swap shouldn't excuse the leakiness of apps.

@suetanvil @ryliejamesthomas @PinkCathodeCat More specifically the article tries to downplay swap's use as an emergency mechanism by acting like apps leaking memory is just a thing that happens, a way of life. Apps don't have to be this way

@HihiDanni @ryliejamesthomas @PinkCathodeCat

I think one needs to acknowledge that we live in an imperfect world and that the software we use will always contain bugs. I mean, you're right that software *shouldn't* have memory leaks but it will, and I'll want to run it anyway.

A design goal of (most) OSs is to be resistant to bugs in user code. Swap is just more of that.

@suetanvil @ryliejamesthomas @PinkCathodeCat An app that uses enough RAM that it results in swapping is one that abuses finite system resources just like one that wastes CPU or thrashes the disk in non-swap ways. Sometimes the issue is the app which means the bugfix should be done in the app. Swap mostly just papers over the problem.