logoalt Hacker News

kriskneztoday at 10:55 AM13 repliesview on HN

I hope there will be an update where when my RAM gets full my PC doesn't freeze and becomes unusable... I remember that Linux and Windows do this in different ways and Windows doesn't have the problem.


Replies

mtgh2stoday at 12:40 PM

From my experience, Windows does freeze and become completely unusable too, just not usually from RAM usage hitting 100%.

I don't use Windows much, nor do I care much about that environment, but from what I've seen it seems to keep RAM usage below 100% most of the time. What I do see pretty often is the drive getting stuck at 100% usage instead, which makes the whole system ridiculously unusable anyway.

show 1 reply
webstrandtoday at 12:20 PM

Its not enabled by default, but enabling MGLRU setting /sys/kernel/mm/lru_gen/min_ttl_ms to 70 has entirely resolved the issue for me. It _does_ usually pick firefox or vscode to kill, but my system remains interactive, with no need for earlyoom.

Docs https://docs.kernel.org/admin-guide/mm/multigen_lru.html#thr...

dormentotoday at 1:38 PM

> Windows doesn't have the problem

Maybe not in the same way then.

Anyways, you've unlocked an old memory of mine, where Windows would crap itself due to low RAM and the fonts and interface elements would render in a "compatible" way, like using "fixedsys" font everywhere.

show 1 reply
kalaksitoday at 11:09 AM

Me too, but you can improve the behavior yourself too. It's been an issue with desktop linux and the default settings for a long time. You could maybe tune OOM killer settings, but another option is to use a package like earlyoom: https://man.archlinux.org/man/earlyoom.1.en

NekkoDroidtoday at 12:34 PM

For me Windows becomes unusable as soon as any of my drives is being hammered, including when it is swapping, but not limited to it.

show 1 reply
jmbwelltoday at 1:09 PM

Solaris family kernels move this problem to run/allocation time, instead of waiting for the system to become unusable before trying to do something about it. Kinda nice

zozbot234today at 12:37 PM

Are these directly comparable, though? Doesn't Windows default to using free space on the system drive to grow the swap file in case of memory pressure? Linux has you set up swap files/partitions explicitly.

show 1 reply
ramon156today at 11:43 AM

earlyoom is what you're looking for. it'll crash the process instead of hang

dolmentoday at 12:34 PM

When my RAM gets full the kernel kills Firefox (3 profiles) so the PC becomes unusable, with lost data.

show 1 reply
Neil44today at 12:09 PM

Windows absolutely does have this problem.

BitPiratetoday at 11:37 AM

zswap and systemd-oomd/earlyoom are your friends.

ggustoday at 12:05 PM

macOS too sadly. by the time you realise there's a problem the machine is already comatose and unresponsive

all these electron apps and invisible virtual machines (looking at you Claude) really don't help.

show 1 reply