Hacker News new | ask | show | jobs
by zygentoma 746 days ago
> On a dev machine? Not on mine for sure. If you think swap is a net positive on a dev machine, then try pasting the following (wrong) code in a bash prompt on Linux:

> We can discuss the results in a couple of hours, when you recover control of your machine. (Note: with no swap and no z-ram, it crashes after 10 seconds; no side effects.)

That might be true for this contrived example. But my real-world experience is exactly the opposite.

In a case of memory over-usage (in my case because of working in a huge bazel project and several browsers open + some electron apps):

- without swap, the system at one point just got immediately so incredibly slow, that the only thing I could reasonably still do was to restart my machine, while

- with swap, the system (at higher memory usage) just got noticably slower and I could close some app / the browser to get into the normal usable regime again.

1 comments

My real world experience is the same as GP's and the opposite of yours.

In case of memory over-usage:

With swap: system becomes unresponsive

Without swap: OOM kills offending process

This has been my real world experience 100% of the time on Linux.