5 ms·
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 w
by krisknez 2mo ago
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.
- deleted 2mo ago[deleted]
- kalaksi 2mo agoMe 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 https://man.archlinux.org/man/earlyoom.1.en
- ramon156 2mo agoearlyoom is what you're looking for. it'll crash the process instead of hang
- BitPirate 2mo agozswap and systemd-oomd/earlyoom are your friends.
- deleted 2mo ago[deleted]
- ggus 2mo agomacOS 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.
- Aperocky 2mo agoOne of the biggest reason I migrated to Codex. I'd like to see each agentic CLI process as a simple building block, and having 100 claude session means I sometimes run out of memory (and I have 256GB of them). Codex never have this problem. The communication is more direct too with GPT5.6 family of LLM. No more belt and suspenders.
- killix 2mo ago[flagged]
- MBCook 2mo agoMacs are also real bad at handling low disk space. I don’t how other OSes do but the best advice on a Mac is to always have a decent amount free. What’s a decent amount? No idea. Don’t test it :)
- LoganDark 2mo agoWhen my Intel Mac ran out of disk space once, it became impossible to clear the space without rebooting (due to APFS's annoying journaling crap or whatever -- it would literally say "rm: can not remove [whatever]: no space left on device" or something), which caused Google Chrome to wipe all my local storage and cookies because it loves to do that when you run out of disk space, and there's no way to get that data back even if you do somehow clear space with the browser still running. I've been bitten by this many times on at least four different platforms. I wish it could just keep everything on disk instead of deleting it all? Like anything that deletes my data automatically can just go die in my opinion. This is one of the reasons I don't use Google Chrome anymore, another is how it deletes "old" history too (after 3 months) even if you have terabytes free, which is just so offensive I can't even explain it. Ungoogled Chromium lets you turn some of this stuff off, but when I moved to Mac I just started using Safari. The only way to save my file system was to boot into recovery mode and run a verification with Disk Utility, then I was able to remove some files and get my space back.
- MBCook 2mo agoFWIW it didn’t do well under HPFS+ either. It’s not a new problem, though it may manifest differently.
- vondur 2mo agoBoth MacOS and Windows start having issues if you have less than 10% of the disk free. The problem with the Mac is your ~/Library/Application support/ folder can get huge and take up a ton of space. Mine is currently at 55GB
- frollogaston 2mo agoI've also found that the fastest way to totally lock up a Mac kernel is to have some external hard drive fail while connected. You will be unable to open, quit, force quit, or reboot, and it won't boot up again unless that drive is disconnected.
- Neil44 2mo agoWindows absolutely does have this problem.
- webstrand 2mo agoIts 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#thrashing-prevention https://docs.kernel.org/admin-guide/mm/multigen_lru.html#thr...
- dolmen 2mo agoWhen my RAM gets full the kernel kills Firefox (3 profiles) so the PC becomes unusable, with lost data.
- alex7o 2mo agouse a browser that saves tabs on disk like zen browser I sometimes stop it when playing games since it will preserve tab state
- NekkoDroid 2mo agoFor me Windows becomes unusable as soon as any of my drives is being hammered, including when it is swapping, but not limited to it.
- sunaookami 2mo agoExplorer freezes too when an external hard drive spins up, very annoying.
- frollogaston 2mo agoI remember my older Macs and Windows 98 laptops liked spinning the CD randomly, sometimes waiting to read it. I'd eject it when I hear it spinning. No CD for you.
- efreak 2mo agoI kept my floppy drive installed until I got tired of explorer freezing every time I accidentally selected it (quite often as I have a habit of navigating with the keyboard)
- trompetenaccoun 2mo agoIt's such a strange issue which existed in Windows for ages, even though on the surface it seems like it would be easy to fix.
- zozbot234 2mo agoAre 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.
- dijit 2mo agoAlso the way memory allocation in Windows works is that if it doesn't actually have the physical RAM (extended by pagefile) then the program will crash. If you disable pagefile (like I did for some of my servers) and your program mallocs more than what you have in available space (even without ever dirtying a page) you will observe this. I'm sure that this helps Windows a lot, even if it's not counted as actually used until the page is dirty. Linux programs very often have virtual addresses many times the amount of physical ram, because there's never been any restriction. It's then very easy to just malloc huge chunks and use what you need and don't care about it too much. Especially with many "tiny" allocations, python for example has huge sized objects which consume gobs of RAM dynamically, so any long running python process not only fragments memory but ends up having a bunch of objects consuming virtual memory... idk why I felt the need to rant about this, but it's a difference that I've noted.
- wongarsu 2mo agoYes, Windows doesn't overcommit memory. In the default config Windows is allowed to grow the page file as much as it wants, and empty pages are cheap to reserve in the page file (no need to actually write those zeros, you just need to reserve space for them). So the end effect is comparable, with the difference that software shouldn't just go ahead and ask for gigabytes of memory it doesn't actually need I prefer the Windows approach, it's more predictable and has better behavior under memory pressure. But it can cause issues with software written under the assumption that the OS uses memory overcommit
- mtgh2s 2mo agoFrom 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.
- W3zzy 2mo agoHaven't had Windows freeze on me for ages. I had a frozen linux server that ran out of RAM yesterday.
- LtWorf 2mo agoUse a windows server then :D
- W3zzy 2mo agoNah, I'm not complaining. I love the freedom of Linux. I'm fairly new at the game so today I'll be teaching myself how not to mess up like this again.
- mtgh2s 2mo agoedit: I meant that regularly hitting OOM on a production server is usually more of a provisioning/resource-management issue. Obviously, how the OS handles OOM once it happens is still its responsibility. Running out of memory on a linux server sounds more like a skill issue than something comparable to how a desktop OS should behave :\
- W3zzy 2mo agoCould be. I'm new to the game. Started homelabbing a year ad a half ago. Thing is that I never know this could happen. As a Windows user I'm used to a system that does stuff in the background without knowing how it works. My Linux VM's can be broken because I'm in charge and I'm a noob. I kind of love it. I've learned so much from troubleshooting.
- jmbwell 2mo agoSolaris 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
- yencabulator 2mo agoecho 2 | sudo tee /proc/sys/vm/overcommit_memory is there on Linux if you want it. https://www.kernel.org/doc/html/latest/mm/overcommit-accounting.html https://www.kernel.org/doc/html/latest/mm/overcommit-account...
- dormento 2mo ago> 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.
- vctrnk 2mo agoWhoa, now that's a trip down the lane. I've seen it too! But only in veeery old Windows, think Win95B or the like.
- anonymars 2mo agoIt happens sometimes, even in the present day: almost certainly it means something leaked and hit 9999 GDI objects (or user objects?) -- you can add those columns in task manager. Killing the offending process should fix it
- augusto-moura 2mo agoHave you tried setting up systemd-oomd [1]? It works by killing the offending process (hopefully) before a true OOM. When I run in a frozen system because of RAM, I'm a happy user of the Magic SysRq 'f' [2], it bypasses most kernel scheduling so it works even on frozen systems [1]: https://man.archlinux.org/man/systemd-oomd.8 https://man.archlinux.org/man/systemd-oomd.8 [2]: https://en.wikipedia.org/wiki/Magic_SysRq_key https://en.wikipedia.org/wiki/Magic_SysRq_key
- qwertox 2mo agoWindows does freeze when a Chromium-based browser decides to hug the pc. Chrome/Vivaldi are the only browsers where, when i have a long HN page open, when i resize it, my laptop freezes for like a minute. Not a full freeze, the mouse still moves, but like it's the year 1999 with a refresh rate of 4 seconds.
- ATMLOTTOBEER 2mo agoTotally fixable w a little configuration (ask Claude) But yeah it’s completely ridiculous and frustrating that the default is to just lock up your DE
- leni536 2mo agoMy experience is that if you have swap you better have a lot of it. Swapping is bad, but swapping and thrashing is a disaster.
- adrian_b 2mo agoI stopped using swap almost a quarter of century ago, and since then I have not seen a PC with Linux freezing because of full RAM. Before the recent increase in RAM prices, it was not difficult to have a generous amount of RAM in a PC, that would make very unlikely the out-of-memory situations. When OOM really happened, it was much better to become aware of this immediately, and reduce the number of concurrent threads for a running job, or whatever caused that, instead of having reduced performance or even freezing.
- jeffbee 2mo agoUnfortunately Linux makes it difficult to fully get away from swapping because any file-backed page is eligible to be evicted, and even if you have "disabled swap" the kernel will cheerfully page-out your program, even if it needs to be immediately paged in again to continue. The only way to stop it from doing so is to remap all executable mappings into anonymous memory, a thing which is possible but which the loader and linker do not make easy.
- cmckn 2mo agoThis type of thrashing was the most common OOM issue I saw on my servers, the system would effectively deadlock until I pulled the plug. In my setup this seemed to be caused by slow-ish disks, and using a small amount of zram made things more CPU-bound / less IO-bound. I haven’t seen the problem since, the OOM killer does what I expect.
- frollogaston 2mo agoTbh hadn't heard about zram in Linux until now, I'll try it
- frollogaston 2mo agoI ran into this last night and learned about it. At 3am.
- debugnik 2mo agoMy PC doesn't have swap and it freezes for about 20 s when I run out of memory until the OOM killer finishes its job, usually by killing Code or more rarely Firefox. I'll take this over the machine swapping so slowly that I need to hard reset anyway, but I'd appreciate it if the OS could stay more responsive when it happens.
- alightsoul 2mo agoThat's because windows always uses swap by default, and your system will freeze if you run out of swap which is usually 33 gigabytes, or ir your drive and ram are full.
- rfgplk 2mo agoConfigure overcommit_memory, overcommit_ratio, admin|user_reserve_kbytes, min_free_kbytes, oom_kill_allocating_task, oom_score_adj; if you're on a dev box make it such that even if you approach memory limits to just instantly start killing processes rather than swapping. It's not a solution for servers, but for dev environments it's basically perfect.
- merb 2mo agoOn servers with k8s the default is preempt based on prio, followed by oom kill and ‚newly’ memory qos: https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/ https://kubernetes.io/docs/concepts/scheduling-eviction/pod-... https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#requests-and-limits https://kubernetes.io/docs/concepts/configuration/manage-res... https://kubernetes.io/docs/concepts/workloads/pods/pod-qos/#memory-qos-with-cgroup-v2 https://kubernetes.io/docs/concepts/workloads/pods/pod-qos/#... (New feature) So normally if you overcommit it might be undefined behavior if you not have enough memory. However if everything is fine pods can preempt based on prio to new nodes. With the right settings only the faulty app might fail. Without it it can be a real pain to find the rouges
- nullsanity 2mo ago[dead]
- akvadrako 2mo agoI had this symptom due to having an SSD without a RAM cache, which caused the latency of disk access to rise to seconds under heavy paging, effectively freezing the computer. Enabling the kyber IO scheduler, tuned for responsiveness over throughput, solved it for me.
- codatory 2mo agoA lot of cargo-culted sysctl tuning blogs will get you there... Linux doesn't have that problem, your chosen distro/config does. E.g., CachyOS is tuned for absolute minimum latency and assumes you won't be heavily multitasking. Using that as a workstation requires adjustments.
- jchw 2mo agoThis seems to always be explained in a confusing and sometimes wrong manner, so I may as well also try to explain it in a confusing and sometimes wrong manner too. Both Windows and Linux allow applications to map memory in an uncommitted state. However, in Linux, uncommitted memory can magically become committed by simply trying to use it, whereas on Windows you have to first actually commit it with a separate API call. You might wonder why you would even bother allocating uncommitted memory on Windows if you have to explicitly commit it later. Simple: just to reserve a contiguous slice of address space for later. The consequence of this is that on Windows an allocation failure usually occurs at an API call where it can return a failure, and indeed does. On Linux though, an allocation can fail during a page fault that is entirely transparent to the application. So instead, the default behavior is to allow overcommit, where applications are allowed to commit more memory than the system actually has, under the assumption that in many cases it won't all be in use at once. Instead of an application hitting an error or crashing on a failed allocation, if there is no memory left, a process simply hangs. Here's my take on why this is the way it is: - Because programs are written without any knowledge of what memory pages are committed, applications will allocate physical memory pages transparently even if they didn't malloc or mmap anything. Because of that, when an allocation fails under memory pressure, it's pretty likely the first page to stall on overcommit isn't really related to the actual memory pressure. - To try to mitigate this, during high memory pressure situations, mechanisms like the OOM killer have to score tasks based on several factors to try to guess which ones are causing the problem. - When you have something like make -j running, it is pretty easy for it to choose Firefox instead of the 200 instances of Clang, since individually none of those Clang instances are really using much memory. This, of course, doesn't fix the bleeding, it just kills your browser. There are ways to mitigate this problem, but they are not often implemented and nothing will ever be perfect. One may wonder if it is worth the trouble... Probably not, but it does have its advantages, particularly when it comes to databases and caches, which can aggressively reserve memory and mmap files and heavily lean on demand paging for memory management. It's just that in this case, managing memory pressure becomes somewhat heuristics-based, and tools like cgroups are often desired to isolate failure domains and control memory allocations in production systems. This is a tough problem to solve. Many improvements to the Linux OOM situation have been made, from simply fixing problems that made the wedging even worse, to tweaking the OOM scoring, to usermode daemons like systemd-oomd that try to catch memory pressure earlier. However, so far this is a solidly unsolved problem - the same exact wedging is still possible today. As hopeless as it seems, I am still open-minded here. The Linux desktop moves slow, but nonetheless it seems pretty good at overcoming challenging obstacles.
- frollogaston 2mo agoJust last night I was debugging some batch job on a Linux box making the machine go unresponsive even though there's no swap. User process taking all the RAM and the OOM killer doesn't stop it, instead the killer itself gets live-locked along with the ssh session or whatever else, so I can't just get in to look at it.
- Dylan16807 2mo ago> even though there's no swap When your OOM killer isn't aggressive enough, not having swap makes you go fully unresponsive sooner. You still get into a situation where the OS keeps having to purge pages and read them again from disk. But without swap one hand is tied behind its back and it can only purge code pages, not data pages.
- frollogaston 2mo agoYeah, I figured in the end that's what was happening
- stillpointlab 2mo agoThis gripe (that I literally crashed out on recently after maining Fedora for the first time) is top of my list for annoyance/frustration with Linux as a desktop. I now have btop permanently running in a Terminal and I habitually Alt-Tab to it to watch my swap. As soon as my free memory gets less than 1 Gb I kill any Firefox tabs (the memory black hole). I know this won't be popular, but Linux people have some kind of Stockholm Syndrome on this. They tell you all of the obscure configuration files you have to edit, the additional programs you install. They insist that just having the OS kill a random program to save the DE is a good plan. It's the typical "your holding it wrong" mantra. I run both Windows and MacOS and have done so for decades. I cannot remember the last time I had a hard freeze like I get on Fedora. On the exact same box running Windows I was able to have VS Code, Chrome with 15+ tabs, terminals, docker, etc. all running with zero issues. On Fedora I have a handful of Terminals and Firefox with less than ten tabs and nothing else running and I have to watch btop like a hawk. The excuses people make are mind bending, and the shifting of blame from the system onto the user is shameful.
- parl_match 2mo agoThe Linux Desktop people have been singing the song of "works for me" for decades, which is as long as they've been unable to crack double digit users.
- stillpointlab 2mo agoI mean, I'm to blame at the moment as well. I'm putting up with it because I don't want to use Windows, mostly because I'm doing a lot of agent dev and I saw them struggle in a Windows environment. And there is a little spite driving me since Windows 11 is full of ads and I felt like it was pushed on me when I wanted to stay on Windows 10. The vast majority of my computer use has been on MacOS for the last 15+ years, since a Macbook Pro is the standard issue dev environment at every company I have worked at. I had a Windows desktop entirely for gaming that I've repurposed to be a Linux dev box. I genuinely thought all of the hype about Linux desktop that I have seen lately was an indication that it was finally ready for general use. Now that I am vigilant watching RAM I haven't had the freezes. And I refuse to let the OS roll the dice on what program it wants to kill in its last ditch attempt to save itself from a problem it shouldn't have in the first place. And since Firefox seems to demand 800MB-1GB per tab process, it is a reliable scheme to just close heavy tabs when I see memory dip into the danger zone. I just wish RAM wasn't so expensive right now, since I'd buy as much as I could just to avoid this pain.
- z_rho_one 2mo agoLinux might freeze from occasional OOMs, but Windows is sluggish and unresponsive even when RAM is far from full with all its unnecessary background processes. That's the difference for me.
- tcdent 2mo agoWait, how does literally no one in this thread mention swap? IME, many default installations in recent years don't configure swap by default. Dedicate a few tens-of-gigabytes on your hard drive and memory overflows there instead of borking.
- Telaneo 2mo agoIt only postpones the inevitable. It doean't actually fix it. I went for a 64 GB swapfile to hopefully not have to worry about it any more, only to find my swapfile full after a few days anyway, even when configuring swappiness to a minimum. Shit just piles up for no apparent reason. I'm sure someone smarter than me can diagnose the problem, but I just decided to reduce the swapfile size to a more sensible value and reboot every now and then. I should probably try Zram or whatever to see if that mitigates the problem.
- tcdent 2mo agoOh, that's just a garden variety memory leak. Most applications these days are very good about that; you likely have just a single app that you use regularly that leaks. If you kill the process the memory will be recovered, save for some allocations the kernel maintains.
- Dylan16807 2mo agoIt's not inevitable for most use cases.
- nomel 2mo ago"top" or maybe "slabtop" will find the offending, very very broken, program that's leaking memory like crazy, making your system doomed no matter what you do or how much physical memory you install.
- deleted 2mo ago[deleted]
- frollogaston 2mo agoSometimes I use swap, but >half the time I'm intentionally disabling it so the system doesn't go into livelock. I'd rather have an OOM than an unresponsive system. Granted this is usually on some headless Linux machine running batch jobs, not my PC.
- teravor 2mo agozram can create a very good buffer for that sort of thing
- mkesper 2mo agoBetter use zswap, as zram and swap together can lead to priority inversion. https://chrisdown.name/2026/03/24/zswap-vs-zram-when-to-use-what.html https://chrisdown.name/2026/03/24/zswap-vs-zram-when-to-use-... (found via lwn.net)
- teravor 2mo agoit depends on what you want to do. in my case I only want disk swap to be used for hibernation. I calibrated the system to make do with the very generous zram compression ratio of 3 and if it doesn't work out a userspace OOM killer will fix it. zswap will be polluting your SSD all the time.
- schmorptron 2mo agoAgreed. I've run into this way too many times, and now with a super aggressive oom killer config it still slows down until vscode or firefox just get closed. I wish it was similar to how it seems to be on MacOS from what I see on friends' screens, where theres some kind of hypervisor running that pops up a nice responsive GUI window saying "hey, xyz is using too much memory, close it or something else" while not locking up. But maybe that's also just the grass being greener on the other side?
- nailer 2mo agoTry changing the Linux scheduler. And yes most desktop OSs are garbage and won’t let you use the fucking keyboard when under load.
- dismalaf 2mo agoYou've never been given a corporate laptop with MS Teams? Mine would literally prevent me from opening apps before it reclaimed memory from Teams...
- qurren 2mo agoI just solved the problem by shoving 192GB of RAM into my desktop and 96GB into my laptop and called it a day. Of course I did this when RAM was cheap but one of the best decisions I have ever made in life.
- godelski 2mo agoDefaults for swapping and paging unfortunately aren't great. But it's easy to adjust. There's lots of information and fwiw, talking with an LLM I found that they ended up suggesting similar things to what I set for my system (pre LLMs). Of course, don't blindly trust, but it was one thing I did to test them (and expected to be relatively good considering the amount of available information, though hard to sort through, especially for non experts). On the other side, many modern distros are getting better defaults. The difficulty here is that the right values are wrong for most setups and Linux is targeting a much broader range of hardware than windows. Though that's where distros come in
- kwar13 1mo agoI'm on Ubuntu 26.04 and I feel it's made substantial improvements in that regard compared to 24.04. It does kill the offending process (well, its best guess at it) before it freezes for good.