@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)
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.
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.
Follow friends and discover new ones. Publish anything you want: links, pictures, text, video. This server is run by the main developers of the Mastodon project. Everyone is welcome as long as you follow our code of conduct!