I Ran Out of RAM… Again
I ran out of RAM yesterday. That is, I filled up all 16GB that I have installed in my computer and it became completely unresponsive to the point where I had to press the reset button. Technically, it’s completely my fault that it happened.
I was running a very RAM-hungry program (a certain well-known game called Minecraft) and I disabled the out-of-memory program killer that I use, earlyoom, so that it wouldn’t kill my game as I was playing it. The game uses about 10-12GB on its own due to being heavily modded which left little headroom before earlyoom noticed and killed it for using too much memory. Although I’m able to play the game while having programs like Riot and Firefox open at the same time, my RAM utilization sits at a precarious 95%, as it was for most of last night.
As I was playing though, this thought slowly faded into the back of my mind. Then, I had the bright idea to watch a video in the background to distract me while I was performing a few mindless in-game chores. I clicked on a link, the tab opened, and everything locked up. I glanced at my status bar and saw the RAM utilization indicator bar completely full; the number next to it read 99%.
When I was installing my operating system and since I only have a 250GB drive, I opted to forgo a swap partition thinking that I had enough RAM to spare and that I’d much rather have the extra gigabytes available for storage. While doing my regular tasks like browsing the internet, using IRC, email, news reader, and chat clients, and listening to music, my RAM usage rarely climbs above 30%. Usually, it’s just games or really intensive compilations which use a lot of RAM but it rarely goes higher than about 70%. On the other hand, however, there are some games which love to eat RAM. Notably, heavily modded versions of Minecraft, Rimworld, and Cities Skylines.
Since I don’t have swap, when I run out of RAM my computer locks up because it’s unable to swap the memory currently used by inactive programs out to disk which means the active programs can’t get the memory they need to continue working. The OOM killer built into the Linux kernel is also very slow to act and struggles to bring the system back into a usable state to the point where it’s much easier to perform a hard reset than to wait the tens of minutes required hoping that my system will recover. Running a program like earlyoom or having a swap file or a swap partition does prevent this from happening except that running earlyoom wouldn’t allow me to play Minecraft for very long before it gets killed, I can’t have a swap file since I’m running btrfs on the 4.19 kernel (I run Debian stable and support for swap files did not come until kernel 5.0), and I didn’t configure my system with a swap partition when installing and it’s a royal pain in the butt to add one now with my encrypted LVM partition scheme.
This series of events, which I have experienced at least half a dozen times now, tempts me to get another 16GB of RAM just so I never have to worry about it happening again. Is it worth it? Well… no, not really. For the work that I do, it’s kind of overkill to spend another $100-$120 on RAM which will go unused for about 98% of the time I’m using my computer. Next time, I’ll just configure my system with swap and hopefully the available OOM killer implementations will be a little more refined so that this rarely happens, if ever, again.
This is my second post for the #100DaysToOffload challenge. You can learn more about this challenge over at https://100daystooffload.com.