My Ridiculous quest for sub 1Gb ram usage (Part 1?)

August 10, 2025 ThePragmaticProgrammer

Tags: , , , ,

Estimated Reading Time: 8 min

Some history

Ever since discovering *NIX based computers back in 2017 (it’s already been almost a decade?!) I’ve had this fascination with squeezing out the most performance I can from my systems, as I’m sure most *NIX users do. Having tried a variety of *NIX systems, including but not limited to: Ubuntu, Debain 10+, Arch (yes I was that person at one point), OpenBSD, Solaris, Mac (wasn’t really my thing although I can see the appeal), Kali (including this even though it’s Debian based as it’s currently my laptop OS), void linux, and most recently NixOS on my desktop; I think it’s safe to say I’ve been around the block enough to finally try and actually achieve my silly goal of sub 1Gb ram usage during daily use.

What is RAM and why should you care

Computers are incredible but they have their limitations, the most prevalent and well known one to most people is RAM. RAM (aka random access memory) is the computer’s working memory, which means that whenever you want to do something it probably gets stored in RAM in some way. Opening a web browser? visited pages and videos are loaded into RAM. Using a tool like Photoshop or a CAD software? all the previous actions are stored in RAM. Editing a text file? most text files will be entirely stored in RAM when working on them as long as they aren’t insanely huge. Booting your computer? you guessed it, RAM is used to load the bootloader that then starts your OS.

So RAM is clearly important to keep computers functioning properly, so why does everything use so much of it and why does no one care? Windows 11 uses ~5Gb of ram at idle which is absolutely insane, partly due to the fact that the windows taskbar and explorer are React Native apps… what?! why would anyone in their right mind make a key OS component in React? I’m sure everyone is also familiar with the memes about Google Chrome needing at least 64Gb of RAM to open 3 tabs or whatever it is now. To answer the previous question, people don’t care becuase most computer users are normal people that just need to open Excel and type numbers for 8 hours before they go home, so they don’t really care about the inner working of computers or software. The second reason is that for the most part, RAM is cheap. There are some conflicting reports on the future price of RAM, with some saying it’s on the rise and others saying it’s on a decline but you can go to Amazon or Newegg or wherever you get your PC parts and get a 16Gb kit for less than $100USD so why care if things use a lot of RAM.

If you’re anything like me and like to tinker with computers and/or find new uses for old systems becuase capitalism is hell and pollution is cringe, I hope you can start to see the value of efficiently using system resources. There’s more I want to say about this but I can’t think of how to say it without sounding political or things like that so I will leave it at, give *NIX based systems a try and maybe see if you can beat my RAM usage.

p.s. If you want to run A.I models locally and don’t have money for 30k of GPU’s then having lots of available RAM will be very handy.

My current state

After being a full-time *NIX user for almost 4 years at this point, 2 of which are also on a laptop so resource usage actually matters for battery life and whatnot, I have picked up on a few ways to keep resource usage down. Which I’ll get into if you want to reduce such things on your system as well, but first lets look at my numbers and see what I’m working with.

Idle (using 699mb)

So at idle my laptop runs at ~700mb of RAM, and while I didn’t bother getting a screenshot of my desktop, it uses ~900mb at idle (it’s on Sway so a few more things happening in the background based on my understanding).

w3m (using 796mb)

With w3m (a minimal text based web browser and pager) open, I’m sitting at a respectable 796Mb of RAM being used.

vim and w3m (using 995mb)

with w3m, multiple instances of vim, rmpc running, and my IRC running, I’m sitting at 995Mb of RAM being used which while absolutely crazy to most people using computers, is practically at the limit of my mission.

At this point I’m sure someone is wondering what my point is, and to you I say… I have no clue but things quickly fall apart when I open a larger text file or add a GUI web browser

large vim (using 1.7gb)
large vim + librewolf (using 2.8gb)

Look at those numbers explode! This is the nature of GUI applications, I’m not going to say you should ditch them becuase everyones use cases are different and while I love me a good terminal sesh, I still occasionally need to use GUI things so I figured I’d throw those in here as well.

How I got low low low

Now that I’ve (hopefully) convinced you that RAM does in fact matter and we should make the most of it, you might be wondering how I got such small numbers to begin with.

  1. Shutdown all those random services you don’t use. Do you use ssh? if not, turn that daemon off (plus it’s good for security). Give your system a good ol’ htop or ps aux and see what’s using up all that RAM, and get rid of it if you don’t need it.

  2. As a kind of sister to point 1, stop hoarding random applications. We all do it, we download some amazing application that will make our life so much easier and then never use it so it just sits there taking up space and probably running in the background. Give your system a nice application clean, it deserves it.

  3. As another sister to the previous steps, clean out your dependencies. On Debian based systems this would be sudo apt autoremove.

Those 3 are pretty boring and probably on every “minimize RAM usage on *NIX” thing every written. Part of the mission (and the challenge of it in my opinion) is that I want my system to still be somewhat usable so I could tell you to go create a custom kernel for Gentoo and run a system that uses 10Mb of RAM and codes through sed and cat but that’s not a good way to use a computer, so below are the real things that have actually lowered my RAM usage by a noticable degree.

  1. Ditching a DE (Desktop Environment). If you find all the bells and whistles of modern OS’s distracting like me (cough cough taskbars and virtual desktops) then try out a WM (Window Manager), which is basically a DE but stripped down to just… the managing of windows, crazy. i3 and dwm are popular choices and you can still use taskbars or whatever if you need, you just have to add them after i.e. polybar. However this is entirely optional. If you were curious, I use bspwm on my main machine (laptop).

  2. Clear your cache with a cronjob. With a simple bash script such as the one below, you can automatically clear your RAM caches and free up those precious Mbs.

#!/bin/bash
sync; echo 3 > /proc/sys/vm/drop_caches

Make sure to replace #!/bin/bash with your shell of choice and the proper location, then you can save this to a script and set it to a cronjob with sudo crontab -e and then add * * * * 7 sh <script location> to the bottom (this example runs once a week) and voila! Free RAM.

  1. Use tmux. I’m sure everyone reading this would know about tmux but if you don’t, it’s a very cool piece of software called a terminal multiplexer, which means you can have one terminal open and then run multiple instances of a terminal in that one. It’s not an exaggeration to say that tmux has completely changed how I use my computers. And since I’m keeping all my terminals in one place and not opening anything for very long anymore since i can just split the pane when needed, i use much less RAM than having 15 million terminals open in case I need them.

  2. Finally, and maybe controversially, ditch the computer. I know this is a bit of a strange one but part of using a tool effectively, and thus using computers effectively, is knowing when to use the tool. So instead of seeing everything as a nail, try doing some stuff on paper in the digital age… I know this is slightly blasphemous but I have found that when I use paper for my notes or sketching out ideas, I have way less things open on the computer which is then using less RAM.

What’s next?

Personally, I’m not entirely sure where I can improve from here but I hope this has given you some ideas on how to go about this kind of stuff as well :) I think I want to switch my laptop to NixOS as well for better reproducibility since I like to tinker so stuff breaks alot, and kali has a lot of extra things I never use so getting rid of those will hopefully lower my RAM usage as well. I may also switch to xmonad as I’ve been on a haskell kick lately (if you couldn’t tell lol) but I gave it a shot a few days ago and saw no resource usage improvements so we’ll see.

Conclusion

As is (now officially) tradition, thank you for reading! This post was mostly just to organize my thoughts so I can try and see what next steps to take, if any, and maybe help someone get the most out of their system. Apologies for the broken TOC on the sidebar, I swear I’m working on that when I can. Also, I apologize for the scuffed pictures, keeping aspect ratio at different sizes is kind of hard with high resolution images so for now you just have to open them in new tabs to zoom in… once again, my apologies.